autoship_cart_has_valid_autoship_items (function)

(src/cart.php) This function checks the cart for items selected for Autoship & returns a boolean. It is used to add the Autoship Free Shipping Option in the cart and checkout, and can be used anytime needing to check the cart for items selected for Autoship.

Example: Hide PayPal Checkout Option When Autoship Items are in the Cart

Example: Hide Amazon Pay When Autoship Items In Cart

Example: Display Autoship Supported Gateway Only When Autoship Items in Cart

Example:

function detect_autoship_items(){
	return autoship_cart_has_valid_autoship_items() ? print_r("<h3>Autoship Items Detected</h3>") : print_r("<h3>No Autoship Items</h3>");
  }
  add_action( 'woocommerce_before_cart_contents', 'detect_autoship_items', 10, 1 );

Still need help? Contact Us Contact Us