Support » Plugin: Pixel Caffeine » AddToCart event issue for variable products

  • Resolved wpmigo

    (@wpmigo)


    Hello.

    We’ve notices an issue related to ‘AddToCart’ event – missing catalog product for the variable products.

    In the advanced settings I’ve enabled the option to not track the variable products as product group.
    https://i.imgur.com/EPloWmf.jpg

    The problem is that for example on the single product page the ID corresponds to the parent product ID, but on the cart page the variation ID is used – which is missing from the catalog.

    Is there a solution for that ?

    Thank you.

    • This topic was modified 1 month, 4 weeks ago by  wpmigo.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Same issue here.

    Content fires correctly with product ID (example 101024) but in Cart and checkout the ID become different (example 101032) and the catalogue doesn’t match it

    Maybe you have some solution for that?

    It’s been ages since I have problems with my variable products and the creation of a catalogue

    • This reply was modified 1 month, 3 weeks ago by  geck888.
    wpmigo

    (@wpmigo)

    @adespresso any idea how to fix this ?

    Plugin Author Antonino Scarfì

    (@antoscarface)

    Hi,

    apologies for the large delay, I’m here now to assist you on the issue!

    So, what you requested is clearly a problem, but not related to the option you shown on the screen, because of that option only set product instead of product_group in the content_type.

    I can add a new option in the next release in order to force parent ID from a variation, in order to match the product catalog.

    For now, I made a workaround: copy and paste the following code in the functions.php file of your current theme or in a new plugin:

    
    function aepc_force_parent_id($params, $event){
        if (!empty($params['content_ids'])) {
            foreach ($params['content_ids'] as &$id) {
                if (($product = wc_get_product($id)) && $product->is_type('variation')) {
                    $id = (string) $product->get_parent_id();
                }
            }
            $params['content_ids'] = array_unique($params['content_ids']);
        }
    
        return $params;
    };
    add_filter('aepc_event_parameters', 'aepc_force_parent_id', 10, 2);
    add_filter('aepc_allowed_standard_event_params', 'aepc_force_parent_id', 10, 2);
    

    In this way, you will force the parent ID for the variations found inside the content_ids parameter.

    I hope it can help you, let me know.

    • This reply was modified 2 weeks, 2 days ago by  .

    Thank you Antonio.

    Yes, that helps to have the same parent ID.

    Thank you!

    Plugin Author Antonino Scarfì

    (@antoscarface)

    I’m glad it helped you!
    You’re very welcome! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.