Last active
January 12, 2017 16:30
-
-
Save bentasm1/700cb8ba81bfadee666aeaa7fadf0b8f to your computer and use it in GitHub Desktop.
WC Vendors Pro - Cart/Checkout Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WC Vendors Pro - Cart/Checkout Filter | |
* This is just an example of the WooCommerce checkout process and cart pages to "check" something and display an error of some | |
* sort. This code does nothing as it is, you'd have to write it inside the custom_checkout_filter function. Some | |
* notes are there to give you an idea on how to get data from the cart, and the WooCommerce notices function that | |
* shows a pretty box with a message. Have fun. | |
*/ | |
add_action( 'woocommerce_checkout_process', 'custom_checkout_filter' ); | |
add_action( 'woocommerce_before_cart' , 'custom_checkout_filter' ); | |
function custom_checkout_filter() { | |
// Do stuff here. | |
// WC()->cart->total will get you the total. Google WC()->cart to find other cool things you can do! | |
// Vendors are post_authors. So, if you need the vendor ID, get the post_author from the products ID, and there you go! | |
// wc_print_notice( 'This error will appear at the top! So, if you have some cool custom message to display within the function, this message would show up @ top of cart and checkout pages.' ), 'error' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment