Support » Plugin: PPOM for WooCommerce » PPOM META not showing in Cart Page (breaking)

  • Resolved wordpresssupporter

    (@wordpresssupporter)


    Hey guys,
    I want to begin with saying that this is a really well developed plugin-in for wordpress and i am so grateful for you guys to have most of the basic options available for free. I recently ran into an issue with the META not showing and also basically “BREAKING” the Cart page in wordpress with the recent versions, 16.4, 16.5, 16.6 and the latest 16.7 version of the plug-in. It works fine in previous versions eg: 16.3. I noticed that it only happens with products that contain variations in “Attributes” and works fine with products that don’t have any attributes associated. I have tried re-saving the settings, etc after upgrading… Please take a look at my screenshot: https://i.imgur.com/dGi4rLU.png

    (The first product in cart didn’t have any attributes (Simple Subscription product) so it shows up fine but the second product has an attribute (variable subscription product) and it breaks the Cart page. )

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author N-Media

    (@nmedia)

    Hi @wordpresssupporter,

    thanks for love our plugin, Can you please share your site details to sales@najeebmedia.com, we will take care of this.

    Plugin Author N-Media

    (@nmedia)

    Hi @wordpresssupporter,

    thanks for sharing details in email, well I checked on your site by add to cart and cart page is just fine with PPOM fields/attribues like:
    https://i.imgur.com/M6Zu2Fm.png

    • This reply was modified 5 months ago by  N-Media.
    wordpresssupporter

    (@wordpresssupporter)

    Hey, that is because as i mentioned in my previous email, i have rolled back to the previous version of PPOM 16.3 since 16.4, 16.5, 16.6 and 16.7 all have the issue i mentioned and my store will lose sales if i enable that version to test. Are you able to create a variable subscription on your demo installation with attributes and see if you have the same issue as me during cart and checkout?
    Thank You!

    Plugin Author N-Media

    (@nmedia)

    Hi,

    Here I have temp variable product with PPOM fields and you can it’s going checkout without any issue.
    https://theproductionarea.net/product/ship-your-idea-2/

    This is still an issue.

    The product options entered on the product page do not appear in the cart or final order information when creating a “Variable Subscription” using the official “WooCommerce Subscriptions” plugin.

    @wordpresssupporter did you end up finding a solution?

    Plugin Author N-Media

    (@nmedia)

    Hi,

    Well, our plugin uses standard WooCommerce hooks to carry data on cart/checkout pages. So subscriptions plugin may kill/disabling these hooks. Please also check with Subscription plugin developers why meta is not being shown on the cart?

    thenbrent

    (@thenbrent)

    Hi @nmedia, can you please let me know which WooCommerce hooks you are using on cart/checkout pages to display meta?

    If you can also provide a link to to where your source code is adding meta data to the cart item, that would be a great help for us to diagnose the conflict.

    • This reply was modified 1 month ago by  thenbrent. Reason: Requesting link to source code for adding meta. Removing other comments
    Plugin Author N-Media

    (@nmedia)

    Hi @thenbrent,

    thanks for taking care of this conflict between PPOM and Subscription plugin. Let me explain how PPOM adds fields to cart page.

    1. Add fields from product to cart session using following filter:

    // Adding meta to cart form product page
    		add_filter ( 'woocommerce_add_cart_item_data', 'ppom_woocommerce_add_cart_item_data', 10, 2);

    ppom_woocommerce_add_cart_item_data callback is defined in inc/hooks.php here: https://plugins.svn.wordpress.org/woocommerce-product-addon/trunk/inc/hooks.php

    2. Once extra fields are added to WooCommerce Cart Session with above hook, we then use following hook to show extra fields on cart page:

    I hope it will help you to understand. If you need any help/question please let me know.
    add_filter ( 'woocommerce_get_item_data', 'ppom_woocommerce_add_item_meta', 10, 2 );

    ppom_woocommerce_add_item_meta callback is also defined inside inc/hooks.php file

    Thanks @nmedia. That’s super helpful and exactly what I needed!

    I’ve traced the issue back to the ppom_get_product_id() function.

    When passed a variation, ppom_get_product_id() is returning the parent variable product’s ID. When passed a subscription variation, its returning the variation’s ID instead of the parent variable subscription product’s ID.

    This is because ppom_get_product_id() checks if a product is a variation with this code: $product->get_type() == 'variation'.

    It’s better for compatibility with 3rd party plugins, like WooCommerce Subscriptions, to check using the WC_Product::is_type() method, like this: $product->is_type( 'variation' ).

    That way, child variation product types, like a subscription variation, will then also be seen as a variation and you can apply the same behaviour to them.

    If the check in ppom_get_product_id() is changed to $product->is_type('variation' ), then I can confirm that the PPOM meta data is being displayed correctly for Variable Subscription products.

    Do you think you’ll be able to add this patch to PPOM?

    Plugin Author N-Media

    (@nmedia)

    Hi @thenbrent,

    thanks for this tip, I have just updated my PPOM version 18.0 (still in beta).

    Plugin Author N-Media

    (@nmedia)

    You can download PPOM Version 18.0 (Beta Release) from this link: https://we.tl/t-hT4QJAhK1C

    Note (this link will be expired in 10 days)

    Thanks for the quick turnaround @nmedia!

    Plugin Author N-Media

    (@nmedia)

    Welcome.

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