|

Deactive Guest Checkout For Certain Products Only
Posted 24 December 2014 - 10:51 AM #1
I would like to deactivate checkout as guest for two products in the catalog only and allow guest checkout for the remaining products. In other words, if one of the two products are in the cart, the user have to register on checkout. If they are not they can choose to checkout as guests.
Has anyone done anything similiar before?
Thank you and merry christmas!
Simen
Posted 24 December 2014 - 11:14 AM #2
<?php use Tygh\Registry; if ($_SERVER['REQUEST_METHOD'] == 'POST') { return; } $cart = $_SESSION['cart']; if (!empty($cart) && !empty($cart['products'])) { $allowed = true; foreach ($cart['products'] as $p) { if ($p['product_code'] == '123' || $p['product_code'] == '456') { $allowed = false; break; } } Registry::set('settings.General.disable_anonymous_checkout', $allowed == true ? 'N' : 'Y'); }
where 123 and 456 are product codes of these products
Then activate the My changes add-on and check the result
Hope that helps
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)
Posted 24 December 2014 - 12:14 PM #3

Posted 24 December 2014 - 02:10 PM #4
Thank you ever so much! That worked perfectly!
Merry christmas!
You are welcome! Merry Christmas to you too!
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart USD 1210 Multi-Vendor USD 1250 Multi-Vendor PLUS USD 3100 (2775)
CS-Cart Ultimate USD 4025 CS-Cart + YOUPI USD 1459 Multi-Vendor Ultimate USD 7500 (6000)