Set up cart threshold discounts and notify customers
With discounts in Sunshine Photo Cart, you can set lots of configuration options on when to apply a discount. One way to get larger order totals is to offer a discount to customers when they reach a certain amount in their cart. For example, “Save $5 on orders over $100”. Combining the minimum order amount and auto apply features of discount codes makes this type of discount easy to setup, see below:
This article assumes and recommends using a discount type of “Amount off order”
The code snippet below will show a notice to your customers until they get their cart total to $100 or above. Be sure to customize the values for the discount threshold and amount to match your offering.
add_action( 'sunshine_before_content', 'sunshine_discount_notice', 1 );
function sunshine_discount_notice() {
$discount_threshold = 100;
$discount_amount = 5;
$cart_subtotal = SPC()->cart->get_subtotal();
if ( $cart_subtotal < $discount_threshold ) {
$difference = $discount_threshold - $cart_subtotal;
SPC()->notices->add( sprintf( __( 'Add %s more to cart to save %s', 'sunshine-photo-cart' ), sunshine_price( $difference ), sunshine_price( $discount_amount ) ) );
}
}
Learn how to add this custom code to your WordPress website
This is what the notice will look like to customers (only on Sunshine Photo Cart related pages):
Still need help?
If you have not yet found your answer in the documentation articles, please contact support