Forum

Thread tagged as: Question, Shop

clear perch_shop_cart_has_property('terms_agreed')

What kind of function I can use to clear perch_shop_cart_has_property('terms_agreed') and make it "NOT agreed"?

On my payment page, afterf succesfull payment I want to clear this property. Is there a way I can do this?

Maciej Pieńczewski

Maciej Pieńczewski 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use perch_shop_set_cart_property('terms_agreed', false);

Thanks Drew, but it does not help.

If have these condtions during checkout flow

if (!perch_member_logged_in()) {} 
elseif (!perch_shop_cart_has_property('terms_agreed')) {} 
else  {}

I have added to my not-succesful-payment page your code, but it does not help.

<?php include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');   
    perch_shop_complete_payment('paypal-express');
    include($_SERVER['DOCUMENT_ROOT'].'/header.php');
    echo '<main>';
    if (perch_shop_order_successful()) {
            echo '<div class="success"><h1>Zamówienie potwierdzone</h1><h3>Wysłaliśmy do Ciebie email z potwierdzeniem zamówienia.</h3><a href="../" class="button--less--white">Zrób nowe zakupy</a></div>';
                perch_shop_empty_cart();
                perch_member_log_out();
    } else{
        // Payment problem! Show instructions to the customer
        echo '<div class="failed"><h3>Ups, wystąpił błąd podczas płatności</h3></div>';
        perch_content('.');
        perch_shop_set_cart_property('terms_agreed', false);
    }
    echo '</main>';
    include($_SERVER['DOCUMENT_ROOT'].'/footer.php');
?>

Drew McLellan

Drew McLellan 2638 points
Perch Support

You could try setting it to null. Otherwise you'll need to destroy the cart to get rid of it.

perch_shop_set_cart_property('terms_agreed', null);

thanks it worked!