Forum

Thread tagged as: Question, Members, Shop

Trade pricing / Wholesale

Hi Can I add tags and a bit of code somewhere that will automatically discount a customers price? I need 3 or 4 pricing tiers. e.g. 5%, 10%, 15%, 20%

William Chicken

William Chicken 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You could automatically apply promotions to offer that discount.

Could you give me a little pointer? Im not sure where that would go. I know it'll be simple )

Drew McLellan

Drew McLellan 2638 points
Perch Support

Create a promotion for the discount you want.

Use perch_shop_set_discount_code('ABC123'); to set it when you determine that the customer qualifies.

Ok, am I on the right lines here

<?php if (perch_member_has_tag('tier1')) { 
        perch_shop_set_discount_code('ABC123');
    }; 
    ?>

and will that work just placed below

<? perch_shop_cart(); ?>

in my cart.php page ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It'll need to go before the cart.

I have placed code as above but the cart is no longer loading. I'm not great with PHP. Is there more I should have done?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, let us know what error you're getting.

It's displaying nothing more than my header. So everything from above the code I've placed. Debug has disappeared too.

Here's my cart.php.. it's basic..

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>

<?php perch_layout('global/header', [
   'body-class' => 'home',
]); ?>

    <?php if (perch_member_has_tag('tier1')) { 
        perch_shop_set_discount_code('ABC123');
    }; 
    ?>

   <? perch_shop_cart(); ?>

    <?php perch_layout('global/footer'); ?>
Rachel Andrew

Rachel Andrew 394 points
Perch Support

What error are you getting in your error log? If PHP is terminating you have an error, what is it?

Hi I've been using the debug but thats not showing now. How do I access the error log? I'm assuming the command line but unsure of the command to use. I'm on a mac and using MAMP.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Wherever MAMP stores the error log, I assume they have some documentation. You need to be able to access the error log to do basic debugging.

I found this

PHP Fatal error: Call to undefined method PerchShop_Cache::set_discount_code()

Here's the complete line from project folder path
[12-Jul-2016 17:22:04 Europe/London] PHP Fatal error: Call to undefined method PerchShop_Cache::set_discount_code() in /perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php on line 184

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, great. In that case, that's simply a bug and we'll get it fixed.

Keep me posted when you do.
Thanks Drew

Drew McLellan

Drew McLellan 2638 points
Perch Support

We've fixed it internally, so it'll be in the next update.

Brilliant! Thanks again )