cart

WooCommerce: Add/display Product or Variation custom field everywhere

醉酒当歌 提交于 2020-01-02 10:06:02
问题 Currently using WordPress 5.1.1 and WooCommerce 3.5.7. My WooCommerce store has around 500 products, made up of simple and variable products. Each product naturally has a SKU, but each product also has a unique ID code called 'Commodity Code'. I sell specific products to a specific industry. I have added the code for the Custom Fields for Simple and Variable product in my functions.php file, and this works great at the moment. My problem is, I have trying to get the 'Commodity Code' to appear

Rails Shopping Cart - not adding to current order

為{幸葍}努か 提交于 2020-01-02 06:10:12
问题 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

Fix maximum coupon Discount On Cart percentage in WooCommerce

风流意气都作罢 提交于 2020-01-01 05:53:30
问题 I have a coupon code (XYZ25) in woocommerce which include 25% off and maximum discount is Rs.250. How can i restrict user's to not get more than Rs.250 Discount if they apply coupon code XYZ25 for 25% discount. 回答1: Since Woocommerce 3.2 or 3.3, this code doesn't work anymore You could set an additional coupon FIX250 code based on a fixed cart discount of ** RS.250 (without tax) and with a Minimun spend of (4 x 250) = RS.1000 . Then with the help of the script below, if customer apply your

Opencart add product options to opencart

心已入冬 提交于 2019-12-31 04:09:08
问题 My cart appears to be working except the product options. When I click add cart button then the item gets added, but no options are added with it. I really don't understand why this is happening as I have submitted the options as an array just as the function requires, using option_id and option_value_id JavaScript called when button is clicked $('#button-cart').on('click', function() { var model_select = $('#model option:selected').val(); alert("working"); $.ajax({ url: '<?php echo $action?>

Cart discount for a product category based on quantity calculations

一曲冷凌霜 提交于 2019-12-31 03:26:06
问题 I wan to add a function to woocommerce that will calculate a 10% discount when 12-23 items from one category is added to the cart. Then if 24 - 47 items of the category are added it would be a 15% discount. Last if 48+ items from this category are added it would be a 20% discount. actual code example would be awesome as I am new to woocommerce 回答1: Updated — Corrected code mistakes and added enhancements in the outputted discount text Here is the function hooked in woocommerce_cart_calculate

Unset removed cart item notice on WooCommerce cart page

我怕爱的太早我们不能终老 提交于 2019-12-30 12:08:10
问题 Is there a way to hide/remove the notice "Product removed. Undo?" on the cart page, when the customer removed the item from the cart? I tried: add_filter( 'woocommerce_cart_item_removed_title', '__return_null' ); but this only hides the title of the product, that has been removed... I couldn't find the right hook of the rest of the line ("removed" and "Undo?") 回答1: To unset " {item_name} removed. Undo? " notice on cart page, you can trick Woocommerce with the following: add_action( 'template

How to set a shipping cost by item in Woocommerce

梦想与她 提交于 2019-12-30 11:29:29
问题 In Woocommerce, when I add multiple products in cart, the shipping only applies to to 1 product. How should I change that to apply the cost to each item? Like in the following image, the shipping cost for printer is applied but the LCD monitor is not. How to set a shipping cost by item in Woocommerce? 回答1: In the Woocommerce Shipping Settings for "Flat rate" Shipping Method, there is many ways to get dynamic settings based on: Item quantity, using [qty] argument Total item cost, using [cost]

Get the Cart shipping label and cost in Woocommerce

天大地大妈咪最大 提交于 2019-12-30 10:45:08
问题 I need to display the shipping cost in other side of cart page. I tried: <?php $current_shipping_cost = WC()->cart->get_cart_shipping_total(); echo $current_shipping_cost; ?> But print value nad don't title of shipping cost, because i use as title: "Express delivery with UPS 24/48 hours 4.90 euro"… How can I get order shipping cost in woocommerce? 回答1: To get and display the chosen shipping method label (and other related data, if needed) in cart page (or in checkout page) : foreach( WC()-

Magento : how to change item price when adding it into the cart

早过忘川 提交于 2019-12-30 05:14:11
问题 I would like to be able to change an item price programmatically (not through catalog or cart rules) when I add it into the cart. The following answer Programmatically add product to cart with price change shows how to do it when updating the cart but not when adding a product. Thanks 回答1: You can use an observer class to listen to checkout_cart_product_add_after, and use a product’s “Super Mode” to set custom prices against the quote item. In your /app/code/local/{namespace}/{yourmodule}/etc

delete session variables when session id is known but not able to start session

荒凉一梦 提交于 2019-12-29 09:33:15
问题 i am having a problem with the way that i am trying to delete some session variables when dealing with paypal and ipn.specifically, i want to have someone logged in (or not) at my online retail store, go through my cart, get redirected to paypal for payment, and then get redirected to my site. i have been using paypal ipn to get paypal to notify me when the payment is complete and i can direct the user back to my site where the session can be started again, but i want to be able to unset the