cart

Rails Shopping Cart - not adding to current order

馋奶兔 提交于 2019-12-05 14:37:13
Rails noob here. I'm building a basic shopping cart and it was working perfectly before. Without changing any code (I git reset --hard to my prev commit where it was working) it broke. (?!?) Here's the breakdown: Github Repo: https://github.com/christinecha/michaka Creates a product. ✓ Adds Product ID to a new Order Item. ✓ Adds Order Item to an Order. ✓ -- Possible Issues ! - New Orders keep being created as you create Order Items = cart is always empty. ! - Cart is not connecting to the right Order ID ! - New sessions are being triggered = new Orders = problem -- ORDER ITEMS CONTROLLER class

WooCommerce cannot access cart from product class

ⅰ亾dé卋堺 提交于 2019-12-05 13:23:36
I have a custom WooComerce product type, and I need to access the cart url from within it. Would seem simple enough: class WC_Product_My_Product extends WC_Product_Simple { public function some_method() { global $woocommerce; $href = $woocommerce->cart->get_cart_url(); } } However: Fatal error: Call to a member function get_cart_url() on a non-object What can possibily be wrong? Is the $woocommerce variable not available when defining a custom product class? If so, is there some internal method / variable to access it? (Or the cart specifically?) Updated for WC 3+ Using $woocommerce->cart =

Change price of product in WooCommerce cart and checkout

前提是你 提交于 2019-12-05 13:20:24
I'm creating a WooCommerce add-on to customize the product, based on selected options by the visitor and custom price is calculated and stored into session table also. I am able to get that value in cart page also. My problem: I would like to change the default price of the product and replace it with new calculated value in the WooCommerce process as cart, checkout, payment, mail notifications, order... Any advice please? Thanks Ce right hook to get it working is woocommerce_before_calculate_totals . But you will have to complete (replace) the code to get the new price in the hooked function

Set a calculated price for variable products in the WooCommerce

时间秒杀一切 提交于 2019-12-05 12:14:10
In Woocommerce, I use custom fields to calculate the price of a product, based on this code - Add custom fields to custom product calculated price in Woocommerce . Thanks for the help LoicTheAztec. // Add a custom field before single add to cart add_action( 'woocommerce_before_add_to_cart_button', 'custom_product_price_field', 5 ); function custom_product_price_field(){ echo '<div class="custom-text text"> <h3>Rental</h3> <label>Start Date:</label> <input type="date" name="rental_date" value="" class="rental_date" /> <label>Period Rental:</label> <select name="custom_price" class="custom_price

Opencart cart across multiple stores with different subdomains

可紊 提交于 2019-12-05 08:14:04
问题 Hi have a single opencart install setup with several stores with different subdomains (all under the same domain). I want customers to be able to put items in the cart on one site, then move onto the next and put in more or even subtract, till eventually a customer checkouts out on any store. Note products might appear in one store but not another. I notice opencart does this somewhat. ie it will bring products already in the cart to the next store but only if the products appear in both

magento: URL querystring for adding product and applying discount coupon to cart

吃可爱长大的小学妹 提交于 2019-12-05 01:45:24
问题 I am a newbie, after extensive research and exploration I am able to figure out the following: To add a product to cart I can use /checkout/cart/add?product= 76 &qty= 1 to apply discount code I can use /checkout/cart/couponPost?coupon_code= WQ9D-XXXX The code for it resides in file: /public_html/app/code/local/Mage/Checkout/controllers/ - I would like to add product and apply discount code in one link such as: /checkout/cart/couponPost?product= 76 &qty= 1 &coupon_code= WQ9D-XXXX OR /checkout

Pass custom calculated product price to cart in Woocommerce

我是研究僧i 提交于 2019-12-04 18:11:03
I have calculated a custom price within the single product page using jquery and have output it as a totalCost variable. How can I use this value and overwrite or pass it through to the checkout to be able to use this new price as the product price? I would post some code but I really dont have a clue where to start. Examples ive seen just set a global price override in the functions file. Many thanks. First step: You should need to add a custom hidden field, where you will pass your calculated price: // Adding a custom imput hidden field in add to cart form add_action( 'woocommerce_before_add

How to clear all produts from cart in PrestaShop

无人久伴 提交于 2019-12-04 17:58:49
I am using PrestaShop version 1.5.4.1 Currently, my cart has separate delete buttons for each product. How can I remove all the products in one action? I just need to empty the cart in one click. I have used this code in ordercontroller and call the function from themes/defaulte/shoopin-cart.tpl public function emptybag() { $products = $this->getProducts(); foreach ($products as $product) { $this->deleteProduct($product->id); } } Many things : $this->getProducts() won't work in the order controler. Use get it with the context instead getProducts() method doesn't return product object, but a

Paypal Express Checkout: Mixed Recurring and Non-Recurring Items

£可爱£侵袭症+ 提交于 2019-12-04 16:56:09
I am working on our company cart which contains products that people can either subscribe to or just buy outright. The problem is that it should require customers to add both types in a single order. Question: It is possible to to tell Paypal to charge selected items as subscription and the others as one-time payments? Thanks in advance. According to the advanced features documentation page 47/48, this is possible by calling SetExpressCheckout with the recurring products as BillingAgreements and the other products as normal, then calling DoExpressCheckoutPayment if there are one-time payments

WooCommerce: Add a discount based on individual items quantity

点点圈 提交于 2019-12-04 15:56:56
In my WooCommerce website I have a few products with the same price of 80$ . I want to add a Discount by the products quantity. The logic is like that: if (Products Quantity is 2){ // the original product price change from 80$ to 75$ each. } if(Products Quantity is 3 or more){ //the original product price change from 80$ to 70$ each. } for example, if a customer pick 2 products, the original price will be (80$ x 2) => 160$ . But after the discount, it will be: (75$ x 2) => 150$ . And… if visitor pick 3 products, the original price will be (80$ x 3) => 240$ . But after the fee, it will be: (70$