This file contains hidden or 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
| <?php | |
| add_action( 'woocommerce_check_cart_items', 'wc_limit_total_products_purchased_check' ); | |
| function wc_limit_total_products_purchased_check() { | |
| global $woocommerce; | |
| $step = 40; | |
| $total_items = $woocommerce->cart->get_cart_contents_count(); | |
| if ( $total_items % $step ) | |
| $woocommerce->add_error( sprintf( __( 'Your must purchase in groups of %s products, please add or remove products to continue.', 'woocommerce' ), $step ) ); | |
| } | |
| ? |
This file contains hidden or 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
| <?php | |
| // Place the following code in your theme's functions.php file | |
| // override the quantity input with a dropdown | |
| function woocommerce_quantity_input() { | |
| global $product; | |
| $defaults = array( | |
| 'input_name' => 'quantity', | |
| 'input_value' => '1', | |
| 'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), |
This file contains hidden or 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
| <?php | |
| // Add previous and next links to products under the product details | |
| add_action( 'woocommerce_single_product_summary', 'wc_next_prev_products_links', 60 ); | |
| function wc_next_prev_products_links() { | |
| previous_post_link( '%link', '< Previous' ); | |
| echo ' | '; | |
| next_post_link( '%link', 'Next >' ); | |
| } | |
| ?> |
This file contains hidden or 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
| #! /bin/bash | |
| # A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn | |
| # The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo. | |
| # main config | |
| PLUGINSLUG="camptix-payfast-gateway" | |
| CURRENTDIR=`pwd` | |
| MAINFILE="camptix-payfast.php" # this should be the name of your main php file in the wordpress plugin | |
| # git config |
This file contains hidden or 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
| <?php | |
| // Change the description tab title to product name | |
| add_filter( 'woocommerce_product_tabs', 'wc_change_product_description_tab_title', 10, 1 ); | |
| function wc_change_product_description_tab_title( $tabs ) { | |
| global $post; | |
| if ( isset( $tabs['description']['title'] ) ) | |
| $tabs['description']['title'] = $post->post_title; | |
| return $tabs; | |
| } |
This file contains hidden or 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
| <?php | |
| add_filter( 'woocommerce_single_product_image_html', 'wc_product_image_slider' ); | |
| function wc_product_image_slider() { | |
| return do_shortcode( '[wooslider slider_type="attachments"]' ); | |
| } | |
| ?> |
This file contains hidden or 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
| <?php | |
| add_filter( 'init', 'wc_tax_exempt_user_roles' ); | |
| function wc_tax_exempt_user_roles() { | |
| if ( ! is_admin() ) { | |
| global $woocommerce; | |
| if ( current_user_can('wholesaler') || current_user_can('distributor') ) { | |
| $woocommerce->customer->set_is_vat_exempt(true); | |
| } else { | |
| $woocommerce->customer->set_is_vat_exempt(false); | |
| } |
This file contains hidden or 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
| <?php | |
| add_filter( 'product_enquiry_send_to', 'wc_product_enquiry_to_vendor', 10, 2 ); | |
| function wc_product_enquiry_to_vendor( $email, $product_id ) { | |
| $vendors = get_product_vendors( $product_id ); | |
| if ( ! empty( $vendors ) ) { | |
| $emails = array(); | |
| foreach( $vendors as $vendor ) { | |
| foreach( $vendor->admins as $admin ) { | |
| $emails[] = $admin->data->user_email; | |
| } |
This file contains hidden or 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
| <?php | |
| add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); | |
| function wc_product_sold_count() { | |
| global $product; | |
| $units_sold = get_post_meta( $product->id, 'total_sales', true ); | |
| echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>'; | |
| } | |
| ?> |
This file contains hidden or 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
| // Add to functions.php | |
| /*=================================================== | |
| Created by sk from Renegade Empire with help | |
| from these sources: | |
| http://docs.woothemes.com/document/editing-product-data-tabs/ | |
| http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N | |
| http://www.sean-barton.co.uk/2013/03/sb-add-woocommerce-tabs-wordpress-plugin/#.UYrYL7XfB6M |