Conflict with
-
Hi, I’m hoping you may be able to help with this issue I’m having.
I have a gift set up to trigger when the customer spends £150, they get a free product. On the cart, when the offer pops up I’m getting a conflict with the Woocomerce Dynamic Gallery plugin.
If its any help the code referred to is..
public static function change_image_in_cart_page( $product_image, $values, $cart_item_key ) {
if ( is_array( $values ) && isset( $values[‘variation_id’] ) && $values[‘variation_id’] > 0 ) {
$variation_id = $values[‘variation_id’];$dgallery_ids = WC_Dynamic_Gallery_Functions::get_gallery_ids( $variation_id );
if ( is_array( $dgallery_ids ) && count( $dgallery_ids ) > 0 ) {
// Use first image from variation gallery
$img_id = (int) array_shift( $dgallery_ids );
$product_image = wp_get_attachment_image( $img_id, ‘shop_thumbnail’ );
}} elseif ( isset( $values[‘product_id’] ) && $values[‘product_id’] > 0 ) {
$product_id = $values[‘product_id’];
// Don’t change the image if product has featured image
if ( has_post_thumbnail( $product_id ) ) return $product_image;$dgallery_ids = WC_Dynamic_Gallery_Functions::get_gallery_ids( $product_id );
if ( is_array( $dgallery_ids ) && count( $dgallery_ids ) > 0 ) {
// Use first image from variation gallery
$img_id = (int) array_shift( $dgallery_ids );
$product_image = wp_get_attachment_image( $img_id, ‘shop_thumbnail’ );
}
}return $product_image;
}Thanks for any help you can offer.
Simon
- The topic ‘Conflict with’ is closed to new replies.