cart

Adding Woocommerce Add to Cart Button to related products and product listing

主宰稳场 提交于 2019-12-22 07:47:11
问题 I'm having some difficulty in adding additional stuffs to WooCommerce as I'm still new to it. I'm trying to add an 'add to cart' button to related products and product listing. Was running through the codes and got stuck at the below. <a href="<?php the_permalink(); ?>"> <?php /** * woocommerce_before_shop_loop_item_title hook * * @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action( 'woocommerce_before_shop_loop_item

Pass custom calculated product price to cart in Woocommerce

前提是你 提交于 2019-12-22 00:18:00
问题 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. 回答1: First step: You should need to add a custom hidden field, where you will pass your

Only allow to purchase one Item In Woocommerce 3

烂漫一生 提交于 2019-12-20 05:15:52
问题 Is there anyway to prevent more than one item for purchase in WooCommerce, or prevent more than one item added to the cart? I have different products but I want to allow only one item per checkout. I tried to search for solution but those existing solutions are not working properly, let's say when user is not signed in and adds an item into cart and then goes to checkout and logins there an item that has been added previously when customer was logged in also adds up to the one customer just

Display cart item count in Woocommerce cart widget

让人想犯罪 __ 提交于 2019-12-20 04:54:21
问题 I am trying to display the count of the items in the cart at the bottom or top of the Woocommerce cart widget. It seems that by default behaviour the cart widget does not do this when in the sidebar. I have researched SO and found the following answer, but it has a slightly different goal of adding individual subtotals. I have tried modifying it, by passing in WC()->cart->get_cart_contents_count() instead of WC()->cart->get_cart() to see if I can get the cart item count, but it's not

Product variations attributes as cart items shows up differently in WooCommerce

。_饼干妹妹 提交于 2019-12-20 03:57:08
问题 I noticed that woocommerce is threating different product attributes differently (see screenshot) . The attributes of the first product are added only with numbers after the dash. The attributes of the second product is listed below the product title. I can't figure out why this happens. How to make all product attributes look like the one of the first product? 回答1: They can be many reasons. Before woocommerce 3 variation attributes where displayed as cart item meta data like "Seirin J + tube

Save product custom field radio button value in cart and display it on Cart page

老子叫甜甜 提交于 2019-12-20 01:43:47
问题 I have added some custom options on woocommerce single product page using the code below on my theme's functions.php: function options_on_single_product(){ ?> <input type="radio" name="option1" checked="checked" value="option1"> option 1 <br /> <input type="radio" name="option1" value="option2"> option 2 <?php } add_action("woocommerce_before_add_to_cart_button", "options_on_single_product"); Now i want to display the selected option value on cart page. Please help me to do this. Thanks 回答1:

Disable all payments gateway if there's specifics products in the Cart

南笙酒味 提交于 2019-12-19 11:24:04
问题 I would like to disable all payments gateways under special situation: I've 2 special products that I don't want to be combined at checkout with any other product. Lets say that my "special" products IDs are 496 and 484 . All other are "normal" products. if one of these "special" products is in the cart, I want to disable "paypal" for example. if a customer has in his cart, at once, a "special" product and a "normal" product, I want to disable all the payments gateway , so he can't checkout.

Display coupon description woocommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-19 10:53:03
问题 I am trying to display coupon description once the coupon is applied (10%) in cart page. To display Total I am using $woocommerce->cart->cart_contents_total How do I display coupon description? 回答1: As you have not mentioned where do you want to have coupon description, I have printed it just before Cart Total . If you want to have it on different place, you can modify action . You can find it from here. Code: add_action('woocommerce_before_cart_totals', 'apply_product_on_coupon'); function

Add custom calculation to cart total and grand total in magento

会有一股神秘感。 提交于 2019-12-19 10:47:30
问题 I am working on site where i want to add/subtract fee to cart total and grand total.I am firing this event to capture the cart details. sales_order_save_after . while in observer i got the price using this code public function modifyPrice(Varien_Event_Observer $obs) { $getotal = Mage::helper('checkout')->getQuote()->getGrandTotal(); $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); $subtotal = $totals["subtotal"]->getValue(); }. But i don't know how to add/subtract

Displaying product thumbnail and attribute in Woocommerce cart and checkout

百般思念 提交于 2019-12-19 10:43:19
问题 I am isplaying product attributes in my Woocommerce checkout table, see my previous question: Show Woocommerce taxonomy in emails I also want to show the product image, so my ideal would be: Product image on the left and beside it product name, in the next row product quantity and after that the attribute. If I use this function add_filter( 'woocommerce_cart_item_name', add_thumbnail_to_cart_items, 10, 3 ); function add_thumbnail_to_cart_items( $product_name, $cart_item, $cart_item_key ){ if