cart

WooCommerce cart quantity won't change after cart update

霸气de小男生 提交于 2021-01-27 16:31:07
问题 I use the following snippet to change WooCommerce add to cart quantity rules. add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 10, 2 ); function custom_quantity_input_args( $args, $product ) { $custom_qty_product_ids = array(27345, 27346); if (!in_array($product->get_id(), $custom_qty_product_ids)) { $args['input_value'] = 25; $args['max_value'] = 500; $args['min_value'] = 25; $args['step'] = 25; } else { if (in_array($product->get_id(), $custom_qty_product_ids)){

Adding a custom button after add to cart button in single product pages

孤者浪人 提交于 2021-01-27 14:09:37
问题 I am developing an ecommerce store based on WooCommerce. I would like to add an View Cart Below the Add To Cart Button. It would be even better if it could only shown after adding at least 1 item in the cart successfully: //add view cart button after add to cart button add_action('woocommerce_after_add_to_cart_button','view_cart_store'); function view_cart_store() { ?> <a class="button wc-forward" href="https://example.xxx/cart/"><?php _e( 'View Shopping Cart', 'woocommerce' ) ?></a> <?php }

Display variations attributes values as separate rows in Woocommerce cart / checkout

倖福魔咒の 提交于 2021-01-27 13:58:55
问题 I have several variable products on our https://alcocovers.com/shop/ The issue I am facing is: upon adding to the cart, Dumpster Tarps has item data listed on cart page, but product Lugger Cover doesn't. Here's a screenshot: I thought there was some issue in the cart item data template I am using on the website, but I checked and nothing is broken (for reference here's the template code https://pastebin.com/fswKRZ8a ). I disabled all custom templates and the results were the same. I also

Removing link from product thumbnail on cart page

家住魔仙堡 提交于 2021-01-24 11:55:10
问题 How can I remove the link (but keep theproduct thumbnail image) fromthe following code <?php $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); if ( ! $product_permalink ) { echo $thumbnail; // PHPCS: XSS ok. } else { printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok. } ?> It is part of the Woocommerce cart.php. I want to keep the link for the product name, but remove it from the

Get tax rate separately for every cart and order items in Woocommerce

空扰寡人 提交于 2021-01-24 08:57:47
问题 I'd like to modify the cart display (and later the invoice) so that there is another column showing the tax and tax rate for each product. I have not found a function or a getter for the tax rate as a number, only the name, with $_product->get_tax_class(). I was looking for a function like $_product->get_tax_rate() but found none. So I wrote a terrible workaround in woocommerce/templates/cart/cart.php. After the easy part of adding <th class="product-tax"><?php esc_html_e( 'Tax', 'woocommerce

Get tax rate separately for every cart and order items in Woocommerce

拜拜、爱过 提交于 2021-01-24 08:57:23
问题 I'd like to modify the cart display (and later the invoice) so that there is another column showing the tax and tax rate for each product. I have not found a function or a getter for the tax rate as a number, only the name, with $_product->get_tax_class(). I was looking for a function like $_product->get_tax_rate() but found none. So I wrote a terrible workaround in woocommerce/templates/cart/cart.php. After the easy part of adding <th class="product-tax"><?php esc_html_e( 'Tax', 'woocommerce

WooCommerce cart subtotal: Display 'free' instead of '0,00'

左心房为你撑大大i 提交于 2021-01-20 13:01:46
问题 i am searching for a solution to display 'free' instead of €0,00 in the WooCommerce Cart/Checkout. I know, there is a snippet for the Single Produkt itself, but is there a possibillity to change the price label even in the Subtotal/total calulation on the checkout/cart page? add_filter( 'woocommerce_get_price_html', 'price_free_zero_empty', 9999, 2 ); function price_free_zero_empty( $price, $product ){ if ( '' === $product->get_price() || 0 == $product->get_price() ) { $price = '<span class=

Using Timber and Shopify, how can I add meta fields on the ajax mini cart of timber?

三世轮回 提交于 2021-01-07 01:21:02
问题 I’m using Timber in a Shopify theme. I would look to add meta fields of the product on the cart. Cart screenshot here The metafields are showing on product i would like to show that on Ajax mini cart too. product page screenshot js code here Let me know if its possible. 回答1: Here are a few examples on how you may access a product's metafields. In the cart page though, because you don't have a direct access to the product object, you should first get access to the product object via the [line

Using Timber and Shopify, how can I add meta fields on the ajax mini cart of timber?

纵然是瞬间 提交于 2021-01-07 01:17:08
问题 I’m using Timber in a Shopify theme. I would look to add meta fields of the product on the cart. Cart screenshot here The metafields are showing on product i would like to show that on Ajax mini cart too. product page screenshot js code here Let me know if its possible. 回答1: Here are a few examples on how you may access a product's metafields. In the cart page though, because you don't have a direct access to the product object, you should first get access to the product object via the [line

Hide coupon discount raw if no coupon has been applied on WooCommerce cart page

故事扮演 提交于 2021-01-07 01:02:51
问题 I add coupons and discounts total savings to my cart page. My code works fine but I have an additional question. This is the code I am currently using: add_action( 'woocommerce_cart_totals_before_shipping', 'show_total_discount_cart_checkout', 9999 ); function show_total_discount_cart_checkout() { global $woocommerce; $discount_total = 0; foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $product = $values['data']; if ( $product->is_on_sale() ) { $regular_price = $product->get