Friday, October 23, 2020

Woocommerce: Checkout Page Customisation

 /**

 * CHECKOUT PAGE CUSTOMISATION

 */



// Remove Coupon form at checkout page

remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );



// Show product thumbnail on checkout page.

// @see {templates|woocommerce}/checkout/review-order.php


add_filter( 'woocommerce_cart_item_name', 'jfs_checkout_show_product_thumbnail', 10, 2 );

function jfs_checkout_show_product_thumbnail( $name, $cart_item ) {

    if ( ! is_checkout() ) return $name;

    $thumbnail = '<span class="product-name__thumbnail" style="float: left; padding-right: 15px">' . get_the_post_thumbnail( $cart_item['product_id'], array( 60, 120 ) ) . '</span>';

    return $thumbnail . '<span class="product-name__text">' . $name . '</span>';

}


No comments: