"change product prices via a hook in woocommerce 3+" Code Answer
Answers related to “change product prices via a hook in woocommerce 3+”
- Get in WooCommerce cart the product ID of a cart item
- How to debug in WooCommerce 3
- Reordering checkout fields in WooCommerce 3
- Hide variation info from cart item title in WooCommerce 3+
- Get all Orders IDs from a product ID in Woocommerce
- Set product sale price programmatically in WooCommerce 3
- Get user geolocated country name in Woocommerce 3
- Add a fee to an order programmatically in Woocommerce 3
- Dynamic cart item pricing not working on orders in WooCommerce 3.0+
- Add a custom field value below product title in WooCommerce archives pages
- Add “View Product” button below add to cart button in WooCommerce archives pages
- Change the cart item quantity for specific products in woocommerce
- Add a checkbox below a specific shipping method in WooCommerce 3
- Add Attributes to Short Description in WooCommerce 3.0+
- Replace product zero displayed price with a custom text in Woocommerce 3
- Create a new shipping method in woocommerce 3
- Reduce product long description in Woocommerce
- Add custom bulk actions to admin orders list in Woocommerce 3
- Move additional information from product tab under add to cart button in WooCommerce
- Change postcode shipping field to a dropdown in Woocommerce
- List product categories hierarchy from a product id in Woocommerce
- Get featured products in Woocommerce 3
- Get the value of a custom checkout field in woocommerce 3
- Change markup in WooCommerce shortcode output
- Pass custom product meta data to the order in Woocommerce 3
- Display a product custom field only in WooCommerce Admin single orders
- How to show a product custom field (custom SKU) in WooCommerce orders
- add a custom checkout billing field under the last name in WooCommerce
- Add a product subtitle in Woocommerce archives pages
- Editing Custom product tab content in Woocommerce Admin product pages
- How to check if product has a specific product attribute in Woocommerce
- How to enable price and inventory for custom product type in WooCommerce
- Adding Extra Add to cart button below product summary in Woocommerce
- How to disable globally backorders in WooCommerce
- Update product price using a hook in Woocommerce
- Display Custom Total Saving in generated invoice in WooCommerce 3
- Checkout distance Calculation Using Google Map API in WooCommerce 3.3
- Set bookable product base cost programatically in Woocommerce Bookings
- Redirect to shop if cart is emptied on cart page in WooCommerce 3+
- Customizing add-to-cart messages based on the product IDs in WooCommerce 3
- Display product optional cost in Woocommerce in order details
- Using a custom taxonomy for products shortcode in Woocommerce 3.3
- Cart bulk quantity discount for specific products in Woocommerce
- Move product meta to the description tab in WooCommerce
- Get the product category name and description in Woocommerce Single Product page
- Add star rating from a product ID on some pages in Woocommerce
- How to get product title in cart in new woocommerce 3.x
- Change all product prices from a specific product tag in Woocommerce 3
- Add and manage Product custom upload field in Woocommerce 3
- Display a random product thumbnail for a product category in WooCommerce
- Display specific custom product attributes on single product pages in Woocommerce
- Auto add a product for cart item from specific product categories in WooCommerce
- Conditionally change products tax class via hooks in WooCommerce
- Getting the value of the product's id value (_product_id) after the payment in WooCommerce
- Limit posts on a WP_Query and in WooCommerce product query
- Automatically assign products to a defined product category in WooCommerce
- Get the Product ID from email templates in WooCommerce 3
- Auto apply or remove a coupon in Woocommerce cart for a specific product id
- Custom checkout field and shipping methods ajax interaction in Woocommerce 3
- Get variations IDs from a variable product in Woocommerce 3
- Exclude a product category from the loop in Woocommerce
- Google analytics integration for a custom Order received page in Woocommerce 3
- Store custom data using WC_Cart add_to_cart() method in Woocommerce 3
- Append text to product title if product has product-tag on cart in WooCommerce
- Change “add to cart” button for purchased products in Woocommerce
- How to programmatically schedule sale dates in Woocommerce
- Set only specific products sale price programmatically in WooCommerce 3
- Change order status for virtual, downloadable, free or backorder products in WooCommerce
- Set programmatically product sale price and cart item prices in Woocommerce 3
- Get all variations attributes with prices for a variable product in WooCommerce
- Get the order fee item details in Woocommerce 3
- Accessing WC_Product protected data in Woocommerce 3
- Custom templates in Woocommerce 3
- Add checkbox to product type option in Woocommerce backend product edit pages
- Using a custom single product template for a specific product category in Woocommerce
- Add Product Attributes with values to a product in Woocommerce
- Add custom column product visibility to admin product list in Woocommerce 3
- Change product variation prices via a hook in WooCommerce 3.3
- Display a custom message when a product is not purchassable in Woocommerce single pages
- Change cart totals title text on cart page in Woocommerce
- Get user meta data from woocommerce_created_customer hook in Woocommerce
- Change checkout order review section in Woocommerce
- Hide product prices and add-to-cart buttons but not variations for unregistered users in WooCommerce
- Calculated distance shipping cart fee via Google API in WooCommerce
- Change Related Products Heading adding the product name in WooCommerce
- Get all active users for a membership plan in WooCommerce
- Product variation WP_Query with a product category in Woocommerce
- Auto add a Product to Cart in Woocommerce 3
- Change label “username” to “account number” in WooCommerce registration
- Remove (optional) text from fields on My account edit address in Woocommerce 3.4+
- Add font awesome icon to custom add to cart button in Woocommerce 3
- Update order meta with cart item custom data in Woocommerce 3
- Replace product image by a placeholder based on user roles in WooCommerce
- Charge a conditional Delivery fee in WooCommerce 3
- Updating product prices cache issue using a SQL query in Woocommerce
- Change Checkout “Billing Details” text for a specific product in Woocommerce
- How can I set tab (only) if the product is in a certain category WooCommerce
- Add a filter dropdown for product tags in woocommerce admin product list
- Save received data to the order from an external delivery service in Woocommerce 3
- Change “You cannot add another (product) to your cart” notice in Woocommerce
- Display on sale cart item formatted prices range in WooCommerce
- Save and display order custom meta data in Woocommerce 3+
- Save and display product selected custom data everywhere in WooCommerce
- Get top level parent product category as body class in WooCommerce
- Check if a product belongs to a specific product category in Woocommerce
- Add a custom field to an order in WooCommerce 3+
- Combine discounted shipping cost with discounted cart items prices in WooCommerce
- Add a new product from a custom product type programmatically in WooCommerce 4
- Changing shipping method label names in Woocommerce 3
- About update product stock status function in WooCommerce 3
- Change add to cart button style when product is in cart in Woocommerce
- Change the “view cart” product overlay button on product loops in Woocommerce
- Add sale percentage to products on sale with a shortcode in WooCommerce
- Change product status if prices are updated in Woocommerce 3
- Change product stock availability texts in Woocommerce
- Set back date paid on paid order statuses change in WooCommerce
- How to set a non existing dimensions measurement unit in Woocommerce 3
- Display number of items sold between dates with a shortcode in WooCommerce
- Append text to product title on multiple pages in WooCommerce
- Show hide Order notes field based on a checkbox in Woocommerce checkout
- Get Order items and WC_Order_Item_Product in WooCommerce 3
- Getting a map() to return a list in Python 3.x
- How do I format a string using a dictionary in python-3.x?
- Create programmatically a variable product and two new attributes in WooCommerce
- Change cart item prices in Woocommerce 3
- If range() is a generator in Python 3.3, why can I not call next() on a range?
- Why does map return a map object instead of a list in Python 3?
- Create an order programmatically with line items in Woocommerce 3+
- Get orders shipping items details in WooCommerce 3
- Creating dynamically named variables in a function in python 3 / Understanding exec / eval / locals in python 3
- How do I change the background of a Frame in Tkinter?
- Replace woocommerce_add_order_item_meta hook in Woocommerce 3.4
- Implementing a backspace in Python 3.3.2 Shell using Idle
- Create programmatically a product using CRUD methods in Woocommerce 3
- Add a shipping to an order programmatically in Woocommerce 3
- Add a line break in Woocommerce Product Titles
- Warning on using project.parent.version as the version of a module in Maven 3
- Get the metadata of an order item in woocommerce 3
- Change Cart total price in WooCommerce
- Change cart item prices based on custom cart item data in Woocommerce
- Get the total stock of all variations from a variable product In Woocommerce
- Remove “(optional)” text from checkout fields in Woocommerce 3.4+
- How can I validate a date in Python 3.x?
- Updating product stock programmatically in Woocommerce 3
- Customizing my-account addresses fields in Woocommerce 3
- Set cart item price from a hidden input field custom price in Woocommerce 3
- Add a product custom field to Admin product bulk edit form in WooCommerce
- Cart item quantity progressive percentage discount in Woocommerce 3
- How to chunk a list in Python 3?
- How I can set a session in codeigniter 3 database?
- Replace add to cart button with a read more linked to product page on shop pages in WooCommerce 3
- Add custom columns to admin products list in WooCommerce 3
- Add a custom column to My Account Orders table in Woocommerce 3+
- Add Text under Single Product Short Description in Woocommerce
- Set custom shipping rates programmatically in Woocommerce 3
- Set different Tax rates conditionally based on cart item prices in Woocommerce
- Database changes for products in woocommerce 3
- Custom order status background button color in Woocommerce 3.3 admin order list
- Unset product tabs for specific product categories in woocommerce
- Hide specifics Flat Rates when Free Shipping is available in WooCommerce 3
- Remove add to cart button for specific product categories in WooCommerce 3
- Cart item discount based on quantity in Woocommerce 3
- What is the best way to drop a table & remove a model in Rails 3?
- How to write bytes to a file in Python 3 without knowing the encoding?
- Is it possible to prefill a input() in Python 3's Command Line Interface?
- How to create multiple simple-products with same SKU in WooCommerce?
- Alternative for the wc_add_to_cart_message hook in Woocommerce for WP
- Add shortened description under the product title in WooCommerce archive pages
- Adjusting product image's Zoom magnification factor in woocommerce 3
- Add custom meta data into emails as a html styled table with a title in Woocommerce
- additional add to cart button with fixed quantity in woocommerce single product pages
- Duplicating a record in Rails 3
- Auto add or remove a freebie product from cart in Woocommerce
- Filter Shipping method based on shipping class in Woocommerce 3
- How to insert the first 3 product images of an order in WooCommerce “My account” orders table
- Display a product custom field only in WooCommerce Admin single orders for Manual Orders
- Assign custom field price as product price to specific user role in WooCommerce
- Targeting product terms from a custom taxonomy in WooCommerce
- Custom decimals in WooCommerce product prices for a product category
- Conditional product prices cart issue in WooCommerce 3
- Change stock status names in WooCommerce variable products selector?
- How to test a scope in Rails 3
- How to change primary ID of a record in Rails?
- Reload a Module in Python 3.4
- WP custom post type cant already add to cart in woocommerce 3.0 above
- Adding “Sale” product category to products that are on sale in Woocommerce
- Update all variations prices of a variable product in Woocommerce
- Remove add cart button in Woocommerce for a specific product category
- How to distinguish an instance method, a class method, a static method or a function in Python 3?
- Keep and get order status history with their time stamps in Woocommerce 3
- Rename Related Products title in Woocommerce 3
- Hide “remove item” from cart for a specific product in WooCommerce
- Get orders from a SQL query displayed on as a list in Woocommerce
- Custom checkout field enable or disable payment methods in Woocommerce 3
- Add the product name to the email subject in WooCommerce
- Additional action buttons to admin order list on Preview Lightbox in Woocommerce 3.3+
- Display product attributes for variations on cart page in woocommerce 3
- Auto add to cart a Gift product variation programmatically in WooCommerce?
- Hiding prices based on visitor location backend bug in Woocommerce
- Change title “Additional Information” in woocommerce
- Update product variations prices in Woocommerce with WPDB query
- How do I convert a string to a buffer in Python 3.1?
- How do I get the user to input a number in Python 3?
- Add custom my account menu item based on user role in WooCommerce 3+
- Rename Add to Cart buttons for Out Of Stock Products in WooCommerce 3
- How to get output of a webpage in ActionScript 3
- Woocommerce - change shipping cost via hooks (functions.php)
- Product category linked terms list related to current product in WooCommerce
- How to change email address of a user in devise “safely”?
- Add a discount programmatically to an Order in Woocommerce 3.2+
- How to get a layer from a feature in Openlayers 3?
- Dynamically add methods to a class in Python 3.0
- How to get the actual HTTP request from a model in rails 3?
- Ajax add to cart button for product variation in WooCommerce 3
- Set min quantity for some product categories or product IDs in Woocommerce 3.3
- How to remove digits from the end of a string in Python 3.x?
- Get file size from “Content-Length” value from a file in python 3.2
- Auto Refresh a page in Rails 3
- Add the product ID after the cart item name in Woocommerce cart page
- How to give foreign key a name in RoR 3?
- Display a custom product field before short description in WooCommerce
- Show product star ratings and count below the price in Woocommerce archive pages
- Is there a way to subclass a generator in Python 3?
- Defining a function name that starts with a number (in Python 3)?
- How to add Variations tab in custom product type in Woocommerce?
- Restrict user role to change only some order statuses in Woocommerce
- How can I set a configurable timeout value for a session in Rails 3?
- Hide quantity fields in cart for specific products in Woocommerce 3
- Add Custom Product Field in WooCommerce 'Order Completed' Emails
- Add a custom button for a specific product category in Woocommerce
- Change default text “Enter a Location” In Google Maps Places API
- How to delete a listener in OpenLayers 3
- Handing conversion from bytes to string when not explicitly opening a file in Python 3
- Which Hook to alter quantity update in WooCommerce cart page?
- how to create dropdown from a hash in rails 3
- Change entire images slices of NIFTI in Python 3.7
- Editable admin custom billing fields error issue in Woocommerce 3
- Display product custom fields as order items in Woocommerce 3
- Disable (remove) the marketing menu option in WooCommerce 4.3.x
- Get and display the variable product price range in Woocommerce 3
- Email notification to a particular address if a specific product is purchased in Woocommerce
- Adding custom text labels to the product prices depending on their type
- Product custom checkbox option that changes Woocommerce cart item price
- Replace product "on backorder" to a custom field value in Woocommerce
- Set a Tracking Number link on customer email notifications in Woocommerce 3
- Customize some checkout fields properties in Woocommerce 3+
- Change product price dynamically woocommerce
- How to retrieve information when linking models through a table in CakePHP 3.0?
- How can I access cookies from a model in Rails 3
- The final cost is not calculated when choosing the weight of the product if the packaging is automatically added in...
Only authorized users can answer the search term. Please sign in first, or register a free account.
1) Plugin version with a constructor function:
The hooks that you are using are deprecated in WooCommerce 3+
To make it work for all products prices, including variations prices, you should use this:
The code tested and perfectly works (only) in WooCommerce 3+.
2) For theme version:
functions.php
file on active child theme (or active theme):Tested and works on woocommerce 3+
For products in sale you have those hooks:
woocommerce_product_get_sale_price
(Simple, grouped and external products)woocommerce_variation_prices_sale_price
(Variable products (min-max))woocommerce_product_variation_get_sale_price
(Products variations)Cached prices and woocommerce 3:
The 3 filters hooks involved in variations cached prices are:
woocommerce_variation_prices_price
woocommerce_variation_prices_regular_price
woocommerce_variation_prices_sale_price
So performances will stay boosted (Thanks to Matthew Clark that pointed this better way)
See: Caching and dynamic pricing – upcoming changes to the get_variation_prices method
For filtering product prices with a widget (min and max price), use the following hooks:
woocommerce_price_filter_widget_min_amount
that has one argument$price
woocommerce_price_filter_widget_max_amount
that has one argument$price