Set a minimum order amount in WooCommerceWoocommerce set minimum order for a specific user roleHow to force minimum charge in Woocommerce, yet not restrict checkout?WooCommerce - Transpose Cart loop in Order loop for pdf invoicesWoocommerce - set a minimum order value per categorySet a minimum amount in Woocommerce cart except for one categoryHow to update total payable amount on checkout page woocommerceAdd Tip input by customer to WooCommerce checkout pageWooCommerce dynamic minimum order amount based feeChange position of “Place order” button Woocommerce CheckoutAdd a percentage to the grand total in WoocommerceRemove conditionally “proceed to checkout” button from minicart in Woocommerce
If infinitesimal transformations commute why dont the generators of the Lorentz group commute?
Closed-form expression for certain product
If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?
What does routing an IP address mean?
Removing files under particular conditions (number of files, file age)
Which one is correct as adjective “protruding” or “protruded”?
How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?
Not using 's' for he/she/it
Biological Blimps: Propulsion
It grows, but water kills it
Store Credit Card Information in Password Manager?
Why does the Sun have different day lengths, but not the gas giants?
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
What was this official D&D 3.5e Lovecraft-flavored rulebook?
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
Is this toilet slogan correct usage of the English language?
Lowest total scrabble score
What should you do when eye contact makes your subordinate uncomfortable?
Are paving bricks differently sized for sand bedding vs mortar bedding?
Open a doc from terminal, but not by its name
How to implement a feedback to keep the DC gain at zero for this conceptual passive filter?
Multiplicative persistence
Delivering sarcasm
How much character growth crosses the line into breaking the character
Set a minimum order amount in WooCommerce
Woocommerce set minimum order for a specific user roleHow to force minimum charge in Woocommerce, yet not restrict checkout?WooCommerce - Transpose Cart loop in Order loop for pdf invoicesWoocommerce - set a minimum order value per categorySet a minimum amount in Woocommerce cart except for one categoryHow to update total payable amount on checkout page woocommerceAdd Tip input by customer to WooCommerce checkout pageWooCommerce dynamic minimum order amount based feeChange position of “Place order” button Woocommerce CheckoutAdd a percentage to the grand total in WoocommerceRemove conditionally “proceed to checkout” button from minicart in Woocommerce
I want to have a minimum order amount in my WooCommerce store. The following code is perfectly showing a notice if the amount isn't reached but the checkout is still possible. How to disable checkout-button when the minimum amount isn't reached?
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount()
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum )
if( is_cart() )
wc_print_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
else
wc_add_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
php wordpress woocommerce cart checkout
add a comment |
I want to have a minimum order amount in my WooCommerce store. The following code is perfectly showing a notice if the amount isn't reached but the checkout is still possible. How to disable checkout-button when the minimum amount isn't reached?
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount()
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum )
if( is_cart() )
wc_print_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
else
wc_add_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
php wordpress woocommerce cart checkout
Try using thewoocommerce_check_cart_items
hook instead.
– ArtisticPhoenix
Mar 7 at 8:00
add a comment |
I want to have a minimum order amount in my WooCommerce store. The following code is perfectly showing a notice if the amount isn't reached but the checkout is still possible. How to disable checkout-button when the minimum amount isn't reached?
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount()
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum )
if( is_cart() )
wc_print_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
else
wc_add_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
php wordpress woocommerce cart checkout
I want to have a minimum order amount in my WooCommerce store. The following code is perfectly showing a notice if the amount isn't reached but the checkout is still possible. How to disable checkout-button when the minimum amount isn't reached?
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount()
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum )
if( is_cart() )
wc_print_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
else
wc_add_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
php wordpress woocommerce cart checkout
php wordpress woocommerce cart checkout
edited Mar 7 at 9:56
LoicTheAztec
94.3k1368108
94.3k1368108
asked Mar 7 at 7:41
Krystian MantheyKrystian Manthey
84425
84425
Try using thewoocommerce_check_cart_items
hook instead.
– ArtisticPhoenix
Mar 7 at 8:00
add a comment |
Try using thewoocommerce_check_cart_items
hook instead.
– ArtisticPhoenix
Mar 7 at 8:00
Try using the
woocommerce_check_cart_items
hook instead.– ArtisticPhoenix
Mar 7 at 8:00
Try using the
woocommerce_check_cart_items
hook instead.– ArtisticPhoenix
Mar 7 at 8:00
add a comment |
2 Answers
2
active
oldest
votes
To set a minimum order amount you can use woocommerce_check_cart_items
action hook this way:
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount()
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If customer update the cart changing quantities or removing items, The behavior will be updated too.
Related answer: Woocommerce set minimum order for a specific user role
add a comment |
function disable_checkout_button()
// Set this variable to specify a minimum order value
$minimum = 50;
$total = WC()->cart->get_cart_subtotal();
if( $total < $minimum )
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
echo '<a style="pointer-events: none !important;" href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button', 1 );
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
add a comment |
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%2f55038477%2fset-a-minimum-order-amount-in-woocommerce%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To set a minimum order amount you can use woocommerce_check_cart_items
action hook this way:
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount()
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If customer update the cart changing quantities or removing items, The behavior will be updated too.
Related answer: Woocommerce set minimum order for a specific user role
add a comment |
To set a minimum order amount you can use woocommerce_check_cart_items
action hook this way:
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount()
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If customer update the cart changing quantities or removing items, The behavior will be updated too.
Related answer: Woocommerce set minimum order for a specific user role
add a comment |
To set a minimum order amount you can use woocommerce_check_cart_items
action hook this way:
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount()
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If customer update the cart changing quantities or removing items, The behavior will be updated too.
Related answer: Woocommerce set minimum order for a specific user role
To set a minimum order amount you can use woocommerce_check_cart_items
action hook this way:
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount()
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If customer update the cart changing quantities or removing items, The behavior will be updated too.
Related answer: Woocommerce set minimum order for a specific user role
answered Mar 7 at 9:56
LoicTheAztecLoicTheAztec
94.3k1368108
94.3k1368108
add a comment |
add a comment |
function disable_checkout_button()
// Set this variable to specify a minimum order value
$minimum = 50;
$total = WC()->cart->get_cart_subtotal();
if( $total < $minimum )
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
echo '<a style="pointer-events: none !important;" href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button', 1 );
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
add a comment |
function disable_checkout_button()
// Set this variable to specify a minimum order value
$minimum = 50;
$total = WC()->cart->get_cart_subtotal();
if( $total < $minimum )
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
echo '<a style="pointer-events: none !important;" href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button', 1 );
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
add a comment |
function disable_checkout_button()
// Set this variable to specify a minimum order value
$minimum = 50;
$total = WC()->cart->get_cart_subtotal();
if( $total < $minimum )
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
echo '<a style="pointer-events: none !important;" href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button', 1 );
function disable_checkout_button()
// Set this variable to specify a minimum order value
$minimum = 50;
$total = WC()->cart->get_cart_subtotal();
if( $total < $minimum )
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
echo '<a style="pointer-events: none !important;" href="#" class="checkout-button button alt wc-forward">Proceed to checkout</a>';
add_action( 'woocommerce_proceed_to_checkout', 'disable_checkout_button', 1 );
answered Mar 7 at 8:24
mujuonlymujuonly
2,79111634
2,79111634
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
add a comment |
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
thanks, this is in general working, but if you then increase cart amount, button is still not working.
– Krystian Manthey
Mar 7 at 8:56
add a comment |
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%2f55038477%2fset-a-minimum-order-amount-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
Try using the
woocommerce_check_cart_items
hook instead.– ArtisticPhoenix
Mar 7 at 8:00