• Resolved igsayonara

    (@igsayonara)


    Can i add custom image with a query? I generates my image and wanna add some product with this image into the cart

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    You can use a filter to override the product thumbnail source for all or specific items in the cart.

    https://docs.cocart.xyz/#filters-overrides-product-thumbnail-source

    Thread Starter igsayonara

    (@igsayonara)

    So i can add one product 2 times and it returns me in cart two products with different images or i have to use woocommerce rest api too make new variation and then add this variation with my custom image

    • This reply was modified 3 years, 12 months ago by igsayonara.
    Plugin Author Sébastien Dumont

    (@sebd86)

    I’m confused now. Can you provide more context as to what your product is?

    Thread Starter igsayonara

    (@igsayonara)

    I have woo shop, whih products. User will be able to customize shirt for example on not wp page. I have to save shirt image after user press complete, and add to cart my shirt with this image

    Plugin Author Sébastien Dumont

    (@sebd86)

    I’m assuming that on your store, the customized shirt is submitted as custom item data. So fetch that data to override the product thumbnail for CoCart.

    Thread Starter igsayonara

    (@igsayonara)

    I add folowing strings to my functions.php

    add_filter( 'cocart_item_thumbnail_src', 'override_item_thumbail_src', 10, 3 );
    
    function override_item_thumbail_src( $thumbnail_src, $cart_item, $item_key ) {
      return 'https://placekitten.com/100/100';
    }

    But when i add my product it doesn’t change thumbnail

    Plugin Author Sébastien Dumont

    (@sebd86)

    The filter works for me. I think your confusing CoCart for something else. This plugin is a REST API so the filter I provided you only changes the item thumbnail for the REST API not WooCommerce.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom image in add to cart query’ is closed to new replies.