Set a minimum order amount in WooCommerce2019 Community Moderator ElectionWoocommerce 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
PTIJ: Why can't I eat anything?
Why would a jet engine that runs at temps excess of 2000°C burn when it crashes?
Unreachable code, but reachable with exception
Am I not good enough for you?
Is there any way to damage Intellect Devourer(s) when already within a creature's skull?
Is there an elementary proof that there are infinitely many primes that are *not* completely split in an abelian extension?
What is the likely impact of grounding an entire aircraft series?
Set and print content of environment variable in cmd.exe subshell?
Why is Beresheet doing a only a one-way trip?
If the Captain's screens are out, does he switch seats with the co-pilot?
Why would one plane in this picture not have gear down yet?
Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?
Is Gradient Descent central to every optimizer?
What wound would be of little consequence to a biped but terrible for a quadruped?
In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?
Is there an equal sign with wider gap?
Do I really need to have a scientific explanation for my premise?
Who deserves to be first and second author? PhD student who collected data, research associate who wrote the paper or supervisor?
Can Mathematica be used to create an Artistic 3D extrusion from a 2D image and wrap a line pattern around it?
Is it true that real estate prices mainly go up?
Finding algorithms of QGIS commands?
Aliens englobed the Solar System: will we notice?
Should QA ask requirements to developers?
Offered promotion but I'm leaving. Should I tell?
Set a minimum order amount in WooCommerce
2019 Community Moderator ElectionWoocommerce 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_itemshook 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
92.2k1366106
92.2k1366106
asked Mar 7 at 7:41
Krystian MantheyKrystian Manthey
71424
71424
Try using thewoocommerce_check_cart_itemshook instead.
– ArtisticPhoenix
Mar 7 at 8:00
add a comment |
Try using thewoocommerce_check_cart_itemshook 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()
// Only run in the Cart or Checkout pages
if( is_cart()
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()
// Only run in the Cart or Checkout pages
if( is_cart()
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()
// Only run in the Cart or Checkout pages
if( is_cart()
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()
// Only run in the Cart or Checkout pages
if( is_cart()
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()
// Only run in the Cart or Checkout pages
if( is_cart()
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
92.2k1366106
92.2k1366106
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,46011332
2,46011332
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_itemshook instead.– ArtisticPhoenix
Mar 7 at 8:00