When adding new product, Auto Increase the price of 10% in WoocommerceHow does PHP 'foreach' actually work?woocommerce shop product variationsVariation Product Shows Price Twice | Wordpress WooCommerceWoocommerce Cart price not matching the selected product priceWoocommerce: Display Total Price when multiple quantities of a variable product are chosenUpdate variation product price - not visible in product page - WoocommerceHow to increase woocommerce product variation price based on monthIncrease all product prices by a percentage including variations in WoocommerceSet programmatically product price to get it displayed everywhere in WoocommerceWooCommerce: Display product total price in cart/minicart instead of product price
Why did the EU agree to delay the Brexit deadline?
What if you are holding an Iron Flask with a demon inside and walk into Antimagic Field?
Can I still be respawned if I die by falling off the map?
putting logo on same line but after title, latex
Limits and Infinite Integration by Parts
Strong empirical falsification of quantum mechanics based on vacuum energy density
Fear of getting stuck on one programming language / technology that is not used in my country
What if a revenant (monster) gains fire resistance?
Recommended PCB layout understanding - ADM2572 datasheet
What exact color does ozone gas have?
Did arcade monitors have same pixel aspect ratio as TV sets?
How do apertures which seem too large to physically fit work?
Why "had" in "[something] we would have made had we used [something]"?
Does the UK parliament need to pass secondary legislation to accept the Article 50 extension
It grows, but water kills it
When were female captains banned from Starfleet?
How to say when an application is taking the half of your screen on a computer
Extract more than nine arguments that occur periodically in a sentence to use in macros in order to typset
System.QueryException unexpected token
Are Captain Marvel's powers affected by Thanos' actions in Infinity War
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
Is there a RAID 0 Equivalent for RAM?
How can mimic phobia be cured?
Open a doc from terminal, but not by its name
When adding new product, Auto Increase the price of 10% in Woocommerce
How does PHP 'foreach' actually work?woocommerce shop product variationsVariation Product Shows Price Twice | Wordpress WooCommerceWoocommerce Cart price not matching the selected product priceWoocommerce: Display Total Price when multiple quantities of a variable product are chosenUpdate variation product price - not visible in product page - WoocommerceHow to increase woocommerce product variation price based on monthIncrease all product prices by a percentage including variations in WoocommerceSet programmatically product price to get it displayed everywhere in WoocommerceWooCommerce: Display product total price in cart/minicart instead of product price
I am using the following code in my WordPress site to increase the product price by 10%. It works fine but the issue is that the price is updated every time by 10% when making any edit in the product. I want it increases the price by 10% only when adding a new product.
I am using WC Marketplace plugin. The code works in the vendor side but not in the WordPress admin panel.
Here is the code I am using:
function get_price_multiplier()
return get_option(10);
// Simple, grouped and external products
add_filter('woocommerce_product_get_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'custom_price', 99, 2 );
// Variations
add_filter('woocommerce_product_variation_get_regular_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'custom_price', 99, 2 );
function custom_price( $price, $product )
$price_per = round($price * get_price_multiplier()/100);
return round($price + $price_per);
Any help is appreciated.
php wordpress woocommerce product vendor
add a comment |
I am using the following code in my WordPress site to increase the product price by 10%. It works fine but the issue is that the price is updated every time by 10% when making any edit in the product. I want it increases the price by 10% only when adding a new product.
I am using WC Marketplace plugin. The code works in the vendor side but not in the WordPress admin panel.
Here is the code I am using:
function get_price_multiplier()
return get_option(10);
// Simple, grouped and external products
add_filter('woocommerce_product_get_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'custom_price', 99, 2 );
// Variations
add_filter('woocommerce_product_variation_get_regular_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'custom_price', 99, 2 );
function custom_price( $price, $product )
$price_per = round($price * get_price_multiplier()/100);
return round($price + $price_per);
Any help is appreciated.
php wordpress woocommerce product vendor
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14
add a comment |
I am using the following code in my WordPress site to increase the product price by 10%. It works fine but the issue is that the price is updated every time by 10% when making any edit in the product. I want it increases the price by 10% only when adding a new product.
I am using WC Marketplace plugin. The code works in the vendor side but not in the WordPress admin panel.
Here is the code I am using:
function get_price_multiplier()
return get_option(10);
// Simple, grouped and external products
add_filter('woocommerce_product_get_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'custom_price', 99, 2 );
// Variations
add_filter('woocommerce_product_variation_get_regular_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'custom_price', 99, 2 );
function custom_price( $price, $product )
$price_per = round($price * get_price_multiplier()/100);
return round($price + $price_per);
Any help is appreciated.
php wordpress woocommerce product vendor
I am using the following code in my WordPress site to increase the product price by 10%. It works fine but the issue is that the price is updated every time by 10% when making any edit in the product. I want it increases the price by 10% only when adding a new product.
I am using WC Marketplace plugin. The code works in the vendor side but not in the WordPress admin panel.
Here is the code I am using:
function get_price_multiplier()
return get_option(10);
// Simple, grouped and external products
add_filter('woocommerce_product_get_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'custom_price', 99, 2 );
// Variations
add_filter('woocommerce_product_variation_get_regular_price', 'custom_price', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'custom_price', 99, 2 );
function custom_price( $price, $product )
$price_per = round($price * get_price_multiplier()/100);
return round($price + $price_per);
Any help is appreciated.
php wordpress woocommerce product vendor
php wordpress woocommerce product vendor
edited Mar 7 at 13:31
LoicTheAztec
94.2k1367107
94.2k1367107
asked Mar 7 at 6:17
Sukhjinder SinghSukhjinder Singh
282214
282214
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14
add a comment |
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55037206%2fwhen-adding-new-product-auto-increase-the-price-of-10-in-woocommerce%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55037206%2fwhen-adding-new-product-auto-increase-the-price-of-10-in-woocommerce%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This will only add the amount showing the price - it will never update the product
– mujuonly
Mar 7 at 7:11
I want this will update price when I am adding new product not while editing existing product.
– Sukhjinder Singh
Mar 7 at 7:13
Its the filter to alter price while showing - it will not update the price into database - I think you are on wrong hook - Or your question is not clear
– mujuonly
Mar 7 at 7:14