cart

Magento override controller

倖福魔咒の 提交于 2019-11-30 20:44:28
I would like to do the above. Ive overridden many files in the past...block, model, helper....but this one eludes me. Can anyone see what im doing wrong here: (ive edited this code...to include some of the recomendations now...) Heres my folder structure (2 controller locations as a test): /Idigital/Idgeneral/etc/config.xml /Idigital/Idgeneral/controllers/Checkout/CartController.php /Idigital/Idgeneral/controllers/CartController.php Heres my config.xml: <?xml version="1.0"?> <config> <modules> <idigital_idgeneral> <version>0.1.0</version> </idigital_idgeneral> </modules> <global> <blocks>

Apply coupon discount via GET method in URL even if cart is empty in WooCommerce

江枫思渺然 提交于 2019-11-30 20:25:49
I have a plugin that sends an advocates referral coupon code to e-mails that they enter. When the audience receives this email I'd like to create a flow where they can click on 'SHOP NOW' in the e-mail and the coupon will be automatically added. As of now, for the link under the 'SHOP NOW' button I've entered the following: websitename.biz/cart__trashed?code=DISCOUNTCODE To handle $code I've put this in my functions.php file: add_action('woocommerce_before_cart', 'discount'); function discount( ) { global $woocommerce; $code= $_GET["code"]; if(!empty($code)){ if($woocommerce->cart->add

Set minimum allowed weight for a specific country in WooCommerce

独自空忆成欢 提交于 2019-11-30 19:20:26
问题 I am trying to specifically apply a mandatory minimum weight of 20 kilos for the country of Colombia avoiding checkout if the total cart weight is under this minimal weight. Here is my actual code, that allow me to fix a minimum weight: add_action( 'woocommerce_check_cart_items', 'cldws_set_weight_requirements' ); function cldws_set_weight_requirements() { // Only run in the Cart or Checkout pages if( is_cart() || is_checkout() ) { global $woocommerce; // Set the minimum weight before

Add custom fields as cart item meta and order item meta in WooCommerce

徘徊边缘 提交于 2019-11-30 16:57:11
This is a plugin on how to add add cart item meta & order item meta for my WooCommerce order. Initially my code below worked well for input type=text. It returns the label for value and the inputed value. On conversion to type=checkbox the code returns label and value="on" for those that are checked. I would like to return the only value names of checked values (ignore the values unchecked). A refactor to help include more checkboxes options would be helpful to reduce written code. My code: <?php global $woocommerce, $product, $post; add_action( 'woocommerce_before_add_to_cart_button', 'add

Redirect Magento to checkout onepage after adding item to cart

女生的网名这么多〃 提交于 2019-11-30 16:20:14
How can I redirect the user after it adds one item to the cart? lets say I want him to choose one item and go to the checkout/onepage, how can I do that? You could create an observer listening for the checkout_cart_add_product_complete event and in there you could do something like the following public function addToCartComplete(Varien_Event_Observer $observer) { // Send the user to the Item added page $response = $observer->getResponse(); $request = $observer->getRequest(); $response->setRedirect(Mage::getUrl('checkout/onepage')); Mage::getSingleton('checkout/session')->setNoCartRedirect(true

Woocommerce add to cart ajax and mini-cart

笑着哭i 提交于 2019-11-30 14:13:45
I need to re-populate mini-cart when product added via ajax add to cart. I manage to update cart quantity with filter woocommerce_add_to_cart_fragments like this: add_filter( 'woocommerce_add_to_cart_fragments', function($fragments) { ob_start(); ?> <div class="cart-contents"> <?php echo WC()->cart->get_cart_contents_count(); ?> </div> <?php $fragments['div.cart-contents'] = ob_get_clean(); return $fragments; } ); And my HTML markup is <div class="cart-contents"> <?php echo WC()->cart->get_cart_contents_count(); ?> </div> Bellow that is hidden div witch showing on .cart-contents hover <div

Shopping Cart Rules with Custom Condition?

别说谁变了你拦得住时间么 提交于 2019-11-30 09:49:07
I have made a coupon [coupon_code = SWIMFREE] if category is swimming equipment and hobby is swimming will be discount by 50%. and now I have problem about 3 steps checkout. Here's the description ... Checkout Cart : to apply to coupon First Step : Shipping and Billing Address Second Step : Pick your Hobby (has another sales_flat_quote table , sales_flat_quote_hobby ) Final Step : Checkout->Overview What i wanted is : when the coupon applied and the hobby is swimming, the third step changing the price to price every product, and coupon is still be shown there. How to intercept the coupon after

CodeIgniter IE not storing sessions correctly

谁都会走 提交于 2019-11-30 09:05:22
问题 I am using the Cart class of CodeIgniter, basically that's just sessions. Now, Safari is handling them perfectly fine and is doing what it is supposed to do. IE, on the other hand, does not store them. So after a while of trying to fix this, I figured to add the sessions to the database. Safari adds one result to the database with all fields filled out. Now IE. It adds around 5 items to the database with the row 'user_data' being empty. This is the method adding the item to the cart; /** *

Ecommerce::Shopping cart::Where should i store shopping cart data in session or in database

落爺英雄遲暮 提交于 2019-11-30 07:36:18
Where should I store shopping cart data in session or in database? (I think in amazon.com shopping cart after user logout and after month login again his orders that he choose in shopping cart saved) Thanks, Yosef Musa Of course shopping cart data is a critical data. Where to save this data it depends on that user which your e-commerce system works. With Not Signed (yet) users - You have to save this data on web storage, html5 gives you ability for this.Simple using Front End Storage, which equips any Browser (Cookie, Session Storage, Local Storage). On checkout process system must require

Cart item quantity progressive percentage discount in Woocommerce 3

拟墨画扇 提交于 2019-11-29 17:36:22
I am trying to apply a TOTAL CART discount to all the items in the cart, depending on the quantity of items added. I have taken and modified the code example from answer here and got most of the logic working. I cannot however get it working for two scenarios described below. It also only applies the rule to a single item in the cart. Not the entire cart. Scenario: If no of items in the cart are between 9-12, Apply 5% Discount to all items. If no of items in the cart are between 13-16, Apply 10% Discount to all items. The discount's should not stack. e.g. when 12 items in cart, apply 5%