Support » Plugin: Paid Memberships Pro » Member discount on variable products

  • Resolved artyfarty

    (@artyfarty)


    The plugin displays regular prices (without member discount) for variable products, in the shop loop and on single product pages.

    I managed to fix this by adding
    if (!is_admin() || defined(‘DOING_AJAX’)) {
    add_filter(“woocommerce_variation_prices_price”, “pmprowoo_get_membership_price”, 10, 2);
    }

    (Not sure this is the best way to do it, but it seems to work)

    Is this something that can be included in an upcoming release? Or is there a better way to fix this issue?
    (And please put in the changelog so I know I can remove this filter, otherwise our members will see a double discount 😉 )

    • This topic was modified 2 years, 6 months ago by  artyfarty.
    • This topic was modified 2 years, 6 months ago by  artyfarty.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Small addendum:

    if (!is_admin() || defined(‘DOING_AJAX’)) {
    if (pmpro_hasMembershipLevel(SOMETHING)) {
    add_filter(“woocommerce_variation_prices_price”, “pmprowoo_get_membership_price”, 10, 2);
    }
    }

    is better, because the filter will be added to the hash used to generate the transient. This way there will be 2 separate entries in the price transient: a set for logged in members, and a set for guests.

    Plugin Author andrewza

    (@andrewza)

    Hi @artyfarty,

    Thank you for getting in touch and using Paid Memberships Pro.

    This is great! I’ll definitely send this through to our development team as I do believe there is a couple of updates that will be releasing for our WooCommerce add-on.

    Here is the github repo – https://github.com/strangerstudios/pmpro-woocommerce

    I hope this helps and thank you so much for sharing the code!

    Have a great day further and please do not hesitate to contact us should you have any further questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Member discount on variable products’ is closed to new replies.