• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2893

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout

Conditionally Remove Available Gateways for Orders Until Set Count is Reached for Specific Products on the Checkout Page

$75.00

Category: WooCommerce Tags: $available_gateways, is_checkout, wc_get_orders, woocommerce_available_payment_gateways, woocommerce_gateway_description, woocommerce_gateway_title
  • Description

This code enables you to restrict payment for a product until a specific level of orders have been submitted. If less than the set amount has been ordered, the available gateways and payment options are removed enabling ordering without payment by C.O.D only until the order limit is reached.

  • The code calculates the order count by number of individual orders not quantity.
  • The code enables you to change the payment gateway title and description.
  • The code also enables you to unset/remove different payment gateways conditionally. In this case based on order count and product I.D

Note : The code includes payment gateway I.D’s to remove WooCommerce Payments ( WooPayments ), WooCommerce PayPal Payments, WooCommerce Stripe Gateway, Cheque and Bank Transfer payment options only leaving the C.O.D option for taking orders when the count is below your set threshold.

Remove Payment Gateways When Under Order Threshold
Display All Payment Options When Order Threshold Reached

Installation

There’s 3 steps :

Step 1 – Install the zip folder as a new plugin or copy and paste the PHP code from the plugin.php file to the end of your child themes functions.php file or custom functionality plugin.

Step 2 – Swap out all instances of 10 with the number you want to limit before payment is enabled for your product.

Step 3 – Swap out the product I.D in the PHP code from 15130 to match your product I.D.

Primary Sidebar

Guaranteed code

Written by Brad Dalton specialist for WooCommerce. Read More…

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Tags
  • Account
  • Checkout
  • Cart
  • Hire Me
 

Loading Comments...
 

You must be logged in to post a comment.