cart

WooCommerce: Add/display Product or Variation custom field everywhere

风流意气都作罢 提交于 2019-12-06 10:29:34
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 under the product title in the Cart, Check Out, invoice and email. I have read various tutorials on

Decrease product quantity in database after order is placed with Laravel

穿精又带淫゛_ 提交于 2019-12-06 09:28:20
I have cart on the site and so far everything work perfectly. Now I'm trying to make quantity for each product which admin can add in backend ( already done ) and when customer order product(s) to decrease quantity in database. So far as I said admin panel is ready and can add quantity to product which is saved in database. Here is my cart submit controller public function orderSubmit() { $cart = Session::get(self::CART_SESSION_KEY, array()); if (count($cart) < 1) { return Redirect::to('/'); } $validatorRules = array( 'captcha' => 'required|captcha' ); Input::merge(array_map('trim', Input::all

Set a minimal order amount for a specific User role in Woocommerce

你。 提交于 2019-12-06 09:14:09
问题 I'm creating a wholesale website. Looking on here I was able to already find code for switching between two user roles after customers place a first order. Now I just need to be able to set minimum order amounts for different user roles on the cart/checkout page and most of what I've been finding does way more than I need it to. Searching online I was able to find this bit of code: <?php /* Author: Doug Edgington Description: Require a minimum order total in Woocommerce for a user role */

Display Custom Field's Value in Woocommerce Cart & Checkout items

被刻印的时光 ゝ 提交于 2019-12-06 08:42:40
问题 I have been looking for a solution for a while all over internet but couldn't find any proper solution. I am using several custom fields in my product page like, 'Minimum-Cooking-Time', 'Food-Availability' etc. So, I like to show this custom field's value in my cart and checkout page. I tried snippets in function file and editing woocommerce cart file too. I have tried several codes but they are not pulling any data from my custom fields. As you can see in the screenshot below, I want to show

Remove conditionally Woocommerce cart items based on a specific product

徘徊边缘 提交于 2019-12-06 08:03:57
A specific WooCommerce product can only be by itself in the cart. So how do I clear the cart while adding this specific product to the cart? and how can I remove this specific product from the cart when adding any other product? I've figured out how to empty the cart when adding a specific product but I don't know how to remove this specific product from the cart when adding any other product. The following will remove conditionally cart items based on a specific product: When the specific product is added to cart, all other items are removed. When any other product is added to cart, it

WooCommerce: Add a discount based on individual items quantity

安稳与你 提交于 2019-12-06 07:55:29
问题 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

How to remove the single cart item using codeigniter cart class?

爱⌒轻易说出口 提交于 2019-12-06 07:21:56
问题 I am using codeigniter cart class for my shopping cart project. I have number of items on the cart. Now I do have cart row id. Now what exactly i need to do is, need to remove the particular item from the cart not all the contents(Destroying cart). $cartcontents = $this->cart->product_options($rowid); and unseting all contents. but doesn't works out. Please do help you anybody have an idea. Thank You. 回答1: $data = array( 'rowid' => '30ef30b64204a3088a26bc2e6ecf7602', 'qty' => 0 ); $this->cart

Adding a custom text under the X button that removes items from cart

自古美人都是妖i 提交于 2019-12-06 07:14:59
With Wordpress and WooCommerce, I am trying to add a custom text "delete item" under the "x" in the shopping cart tthat removes items from cart. I tried to "inspect element" to find where this "x" text icon was located, but I am hitting a brick wall. Any suggestions on how I can find this, and amend the "x" button to include text underneath? Thanks. add_filter('woocommerce_cart_item_remove_link', 'remove_icon_and_add_text', 10, 2); function remove_icon_and_add_text($string, $cart_item_key) { $string = str_replace('class="remove"', '', $string); return str_replace('×', 'Delete Item', $string);

Checking cart items for a product category in Woocommerce

一世执手 提交于 2019-12-06 07:11:16
In woocommerce, I'm trying to check in cart items for a particular product category using: add_action('woocommerce_before_cart', 'fs_check_category_in_cart'); function fs_check_category_in_cart() { // Set $cat_in_cart to false $cat_in_cart = false; // Loop through all products in the Cart foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $product = $cart_item['data']; echo '<pre>',print_r($product),'</pre>'; // If Cart has category "download", set $cat_in_cart to true if ( has_term( 'downloads', 'product_cat', $product->get_id() ) ) { $cat_in_cart = true; break; } } // Do

Changing colors for decision tree plot created using export graphviz

自古美人都是妖i 提交于 2019-12-06 04:29:08
问题 I am using scikit's regression tree function and graphviz to generate the wonderful, easy to interpret visuals of some decision trees: dot_data = tree.export_graphviz(Run.reg, out_file=None, feature_names=Xvar, filled=True, rounded=True, special_characters=True) graph = pydotplus.graph_from_dot_data(dot_data) graph.write_png('CART.png') graph.write_svg("CART.svg") This runs perfectly, but I'd like to change the color scheme if possible? The plot represents CO 2 fluxes, so I'd like to make the