• Sam

    (@xumbrella)


    Hi, I have products that that can reside in more than one category for example

    Clothing >> T-Shirt
    Seasonal Collection >> Spring

    Is there a way of telling GTM4WP to only use one top-level category? So if I had two products:

    Clothing >> T-Shirt
    Clothing >> Sweat Shirt

    The categories would be set as “T-Shirt” and “Sweat Shirt”.

    This would also be useful for using category for brands in the eCommerce settings so it uses the correct category every time for example I have:

    Brand >> Adidas

    At the moment I have some products with one category trail and one from another.

    Many thanks
    Sam

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi Sam,

    GTM4WP currently uses the first category reported by WooCommerce for data generation. If somehow you can manage to hook into that process with your own PHP code, you may be able to change what is reported in enhanced ecommerce.

    You can also hook into the gtm4wp_eec_product_array WordPress filter with your own PHP code to change what values are passed to products.

    Thread Starter Sam

    (@xumbrella)

    Hi Thomas, we use Yoast to set the primary category for a product, because Woocommerce seems unpredictable, so if a product belongs to two categories, eg:

    Clothing >> T-Shirt
    Brand >> Adidas

    Other than using yoast, there is no way to make sure Woocommerce uses the correct one as primary. It almost seems to be random.

    any thoughts on working around this would be greatly appreciated.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Since the WooCommerce extension of Yoast is a paid plugin, I can not examine how Yoast’s plugin stores the primary category option. It might be a simple post meta data but I am not sure. I could add some functionality to into GTM4WP to respect this option but to do so I would need to see how the Yoast WooCommerce module is working in the background.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting primary category’ is closed to new replies.