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
function remove_free_shipping_items( $packages ) { | |
foreach( $packages as $i => $package ){ | |
foreach ( $package['contents'] as $key => $item ) { | |
if ( $item['data']->get_shipping_class() == 'free' ) { | |
unset( $packages[$i]['contents'][$key] ); | |
add_filter( 'woocommerce_cart_needs_shipping', '__return_true' ); |
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
/* | |
* Add new checkout fields | |
* See: https://www.kathyisawesome.com/woocommerce-customize-checkout-fields/ for saving/displaying order meta | |
*/ | |
function kia_filter_checkout_fields( $fields ){ | |
$fields['extra_fields'] = array( | |
'some_field' => array( | |
'type' => 'text', | |
'label' => __( 'Some field', 'your-plugin-textdomain' ) | |
), |
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
/** | |
* Limits the mix and match item's input quantity to 1 | |
* @param int $qty - the max quantity allowed in this product's quantity input | |
* @param obj $mnm_item - the child product | |
* @param obj $product - the container product | |
* @return int | |
*/ | |
function kia_set_max_mnm_quantity( $qty, $mnm_item, $product ){ | |
$purple_id = 37; // product ID of the purple product; | |
$container_id = 220; // product ID of the mix and match container product |
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
<?php | |
/** | |
* Plugin Name: Patch for WooCommerce Mix and Match plus Ultimate VC Addons | |
* Plugin URI: https://gist.github.com/helgatheviking/7360234c4bf6caf14732f1f21539625b | |
* Description: Ultimate VC Addons uses Select2 v3, so switch the MNM "legacy" version of allowed contents input. | |
* Version: 1.0.0 | |
* Author: Kathy Darling | |
* Author URI: http://kathyisawesome.com/ | |
* WC requires at least: 2.4.0 | |
* WC tested up to: 3.2.0 |
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
/** | |
* Add Name Your Price support to Grouped Products. | |
* Caveat: must override the /single-product/add-to-cart/grouped.php template and move | |
* <?php do_action( 'woocommerce_grouped_product_list_before_price', $grouped_product ); ?> | |
* inside the following element | |
* <td class="price"> | |
* This is what I'm hoping will be merged into core: https://github.com/woocommerce/woocommerce/pull/17111 | |
* Alternatively, you can add ANY hook name you want there as long as it matches the add_action() below | |
* For more information, read the docs: https://docs.woocommerce.com/document/template-structure/ |
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
<?php | |
/** | |
* Plugin Name: Price Upon Request | |
* Plugin URI: https://gist.github.com/helgatheviking/6278f960f5fb7fca101e75f30f33141c | |
* Description: Switch Free prices to "Price upon Request" | |
* Version: 0.1.0 | |
* Author: helgatheviking | |
* Author URI: https://kathyisawesome.com | |
* Requires at least: 4.7 | |
* Tested up to: 4.7 |
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
add_action( 'woocommerce_product_options_stock_status', 'so_27971630_hide_if_logged_out' ); | |
function so_27971630_hide_if_logged_out(){ | |
woocommerce_wp_checkbox( array( 'id' => '_hide_if_logged_out', 'wrapper_class' => 'show_if_simple show_if_variable', 'label' => __( 'Hide this product from archives when not logged in?', 'your-plugin-domain' ) ) ); | |
} | |
add_action( 'woocommerce_admin_process_product_object', 'so_27971630_save_product_meta' ); |
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
<?php | |
/** | |
* Display individual MNM option prices | |
* | |
* @param obj $mnm_item WC_Product of child item | |
* @param obj WC_Mix_and_Match $product the parent container | |
*/ | |
function kia_add_individual_prices( $mnm_item, $parent_product ) { | |
if( $parent_product->is_priced_per_product() ) { | |
echo '<p class="price">' . $mnm_item->get_price_html() . '</p>'; |
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
<?php | |
/** | |
* Remove thumbnail column from MNM product options | |
* The table column header must be removed by overriding the single-product/mnm/tablular/mnm-items-wrapper-open.php template | |
*/ | |
function kia_remove_thumbnail_column() { | |
remove_action( 'woocommerce_mnm_child_item_details', 'wc_mnm_template_child_item_thumbnail_open', 10 ); | |
remove_action( 'woocommerce_mnm_child_item_details', 'wc_mnm_template_child_item_thumbnail', 20 ); | |
remove_action( 'woocommerce_mnm_child_item_details', 'wc_mnm_template_child_item_section_close', 30 ); | |
add_filter( 'woocommerce_mnm_tabular_column_headers', 'kia_remove_thumbnail_column_header' ); |
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
<?php | |
/** | |
* Display individual MNM option descriptions | |
* | |
* @param obj $mnm_item WC_Product of child item | |
* @param obj WC_Mix_and_Match $product the parent container | |
*/ | |
function kia_add_individual_info( $mnm_item, $parent_product ) { | |
echo '<p class="desc">' . $mnm_item->get_short_description() . '</p>'; | |
} |