Thread tagged as: Question, Shop

shop checkout with $ or Points depends on product type

I want users to checkout products depending on their type. If a product is $$$ item, treat it as payable checkout, ability to switch currency (GBP, etc) and if the product is marked as "points only" item, it should only let the user checkout using the points they may have as their balance.

How is the best way to achieve above?

sawan ruparel

sawan ruparel 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use skip-template to get the contents of the cart as a PHP array. You'd then need to loop through and examine what you have and branch to use the appropriate checkout method based on what you find.


Here is how I want to flow to work, please suggest what is best way to do it.

  1. products sold with $$ only: customer adds to cart and checkout using payment method

  2. products sold with points only: customers clicks on "get now" and he is asking to select or enter shipping address, once done, he is directly shown thank you page.
    If it is a point item, the checkout flow will be different. We don't want him to add multiple items to cart and checkout, points item would be 1 per order.

2a. imp: I think I can hide "get now" button on product details page if customer does not have enough points to redeem.

So far, I have been able to checkout all products to cart, points item show up as $0.0, but I don't want that. I don't want points item in cart. I want them as above.

Your expert guidance requested :-)

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you need to switch to using the manual gateway to checkout when your cart balance is zero.

How are you managing your points system?

How do I switch between gateways?

I have a 3rd party service that managed points. I am using API to get points based on customers email address

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'd just use a basic if statement.

if (condition) {
    perch_shop_checkout('gateway-a', [...]);
} else {
    perch_shop_checkout('gateway-b', [...]);

Can I remove individual items from cart ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can use perch_shop_remove_from_cart($productID)