View dequeue-script-example.php
function kia_unload_script() { | |
if ( function_exists( 'is_product' ) && is_product() ) { | |
wp_dequeue_script( 'wc-single-product' ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'kia_unload_script', 20 ); |
View wc-mnm-simplify-variation-names.php
<?php | |
/** | |
* Plugin Name: WooCommerce Mix and Match Products - Simplify variation names | |
* Plugin URI: https://woocommerce.com/products/woocommerce-mix-and-match-products | |
* Description: Reduce container variation names to only their attributes | |
* Version: 1.0.0 | |
* Author: Kathy Darling | |
* Author URI: https://kathyisawesome.com | |
* Requires at least: 5.5 | |
* Requires PHP: 7.0 |
View short-description-in-loop.php
<?php | |
/** | |
* Display short descriptions in loop | |
*/ | |
function kia_display_short_desciption_in_loop() { | |
global $product; | |
$short_description = $product->get_short_description(); | |
View kia-local-dev.php
<?php | |
/** | |
* Plugin Name: Local Dev modifications | |
* Plugin URI: https://kathyisawesome.com/ | |
* Description: Custom snippets for local development | |
* Version: 1.0.0 | |
* Author: Kathy Darling | |
* Author URI: https://kathyisawesome.com | |
*/ |
View wc-mnm-ups-bridge.php
<?php | |
/** | |
* Plugin Name: WooCommerce Mix and Match - PluginHive UPS Bridge | |
* Plugin URI: http://www.woocommerce.com/products/woocommerce-mix-and-match-products/ | |
* Description: Add support for Mix and Match products to UPS shipping. | |
* Version: 1.0.0 | |
* Author: Kathy Darling | |
* Author URI: http://kathyisawesome.com/ | |
* WC requires at least: 4.0.0 | |
* WC tested up to: 4.4.0 |
View wc-mnm-external-grouping.php
<?php | |
/** | |
* Plugin Name: Mix and Match external product parents | |
* Plugin URI: https://gist.github.com/helgatheviking/af72435b3cf729886b852c61c0f2d38c | |
* Description: Fix add to cart URL/text for external products that don't have an external URL. Like when using a product table to group products together. | |
* Version: 1.0.0 | |
* Author: Kathy Darling | |
* Author URI: https://kathyisawesome.com | |
* Text Domain: mnm-external-parent | |
* Domain Path: /i18n/languages/ |
View wc-sub-prevent-switching-before-renewal.php
/** | |
* Disable contents switching for window prior to renewal | |
* | |
* @param boolean $can | |
* @param WC_Order_Item $item | |
* @param WC_Subscription $subscription | |
* @return boolean | |
*/ | |
public static function kia_prevent_modification_of_subscription( $can, $item, $subscription ) { |
View mnm-rest-api-create-mix-and-match-product.txt
curl -X POST https://example.com/wp-json/wc/v3/products \ | |
-u consumer_key:consumer_secret \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"name": "Sample Six Pack", | |
"type": "mix-and-match", | |
"regular_price": "0", | |
"description": "So many products to choose from.", | |
"short_description": "Pick 6.", | |
"categories": [ |
View display-attributes-as-table.php
<?php | |
/** | |
* Attributes shortcode callback. | |
*/ | |
function so_39394127_attributes_shortcode( $atts ) { | |
global $product; | |
if( ! is_object( $product ) || ! $product->has_attributes() ){ |
View xdebug-var-dump.css
.xdebug-var-dump { | |
/* These are technically the same, but use both */ | |
overflow-wrap: break-word; | |
word-wrap: break-word; | |
-ms-word-break: break-all; | |
/* This is the dangerous one in WebKit, as it breaks things wherever */ | |
word-break: break-all; | |
/* Instead use this non-standard one: */ |
NewerOlder