• Resolved odabos

    (@odabos)


    Hello. How to make sure that the main picture of the product is displayed in the admin panel Woocommerce-Order when ordering, and not its variations?

    function getCartItemThumbnail( $img, $cart_item ) {

    if ( isset( $cart_item[‘product_id’] ) ) {
    $product = wc_get_product($cart_item[‘product_id’]);

    if ( $product && $product->is_type( ‘variable’ ) ) {
    // Return variable product thumbnail instead variation.
    return $product->get_image();
    }
    }

    return $img;
    }

    add_filter( ‘woocommerce_cart_item_thumbnail’, ‘getCartItemThumbnail’, 111, 2 );

    I changed it on the store page using this code. But it didn’t work in the admin panel. Please help me how to fix this. Using a plugin Variation Swatches for WooCommerce. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Admin panel to replace the image variations product’ is closed to new replies.