Open reykjalin opened 2 years ago
Sidenote: it may be better to pass the actual product objects to the filters so plugins/merchants won't have to make database requests for the actual product information to make a decision on whether to hide the PRBs or not.
Let's go with passing Product Objects instead of Product IDs to save anyone hooking into the filters a trip to the DB.
I think WC core may be shifting to a similar idea for some of its own filters too.
I think based on the discussion in #2099 we'll want to introduce 3 new filters to replace the current PRB visibility filters:
wc_stripe_show_payment_request_for_product
: Will receive a Product ID as a parameter; returningfalse
will hide the PRB on that product's page.wc_stripe_show_payment_request_on_cart_for_cart
: Will receive an array of Product IDs; the products currently in the cart. Returningfalse
will hide the PRB on the cart page for a given cart.wc_stripe_show_payment_request_on_checkout_for_cart
: Will receive an array of Product IDs; the products currently in the cart. Returningfalse
will hide the PRB on the checkout page for a given cart.Once these filters have been out for 1-2 release cycles we should deprecate the filters they will replace again:
wc_stripe_show_payment_request_on_cart
wc_stripe_show_payment_request_on_checkout
wc_stripe_hide_payment_request_on_product_page
Originally brought up by @reykjalin in https://github.com/woocommerce/woocommerce-gateway-stripe/issues/2099#issuecomment-1039764193