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
Eliminate All Blocks from Editor | |
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]); | |
How to disable and lock Gutenberg blocks | |
https://kinsta.com/blog/disable-gutenberg-blocks/ | |
Convert group of file blocks to ACF block | |
https://bdwm.be/gutenberg-case-study-convert-group-of-file-blocks-to-acf-block/ | |
Enabling Gutenberg-Based Custom Post Types and Taxonomies |
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 | |
//Loop through each item from the cart | |
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { | |
//get the current product ID | |
$product_id = $cart_item['product_id']; | |
//first - check if product has variations | |
if(isset($cart_item['variation']) && count($cart_item['variation']) > 0 ){ | |
//get the WooCommerce Product object by product ID | |
$current_product = new WC_Product_Variable($product_id); | |
//get the variations of this 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 | |
/** | |
* Check if a specific product category is in the cart | |
*/ | |
function wc_ninja_category_is_in_the_cart() { | |
// Add your special category slugs here | |
$categories = array( 'clothing', 'posters' ); | |
// Products currently in the cart | |
$cart_ids = array(); |
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 | |
/** | |
* Conditionally remove a checkout field based on products in the cart | |
*/ | |
function wc_ninja_remove_checkout_field( $fields ) { | |
if ( ! wc_ninja_product_is_in_the_cart() ) { | |
unset( $fields['billing']['billing_company'] ); | |
} | |
return $fields; |
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 | |
/** | |
* Check if a specific product ID is in the cart | |
*/ | |
function wc_ninja_product_is_in_the_cart() { | |
// Add your special product IDs here | |
$ids = array( '45', '70', '75' );; | |
// Products currently in the cart | |
$cart_ids = array(); |
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 | |
/** | |
* Process Order Refund through Code | |
* @return WC_Order_Refund|WP_Error | |
*/ | |
function ibenic_wc_refund_order( $order_id, $refund_reason = '' ) { | |
$order = wc_get_order( $order_id ); | |
// IF it's something else such as a WC_Order_Refund, we don't want that. |
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 | |
/** | |
* WARNING! THIS SNIPPET MAY BE OUTDATED. | |
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library: | |
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-round-robin.php | |
*/ | |
/** | |
* Gravity Wiz // Gravity Forms // Rotating Values | |
* http://gravitywiz.com/ | |
*/ |
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( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( 'wc_user_membership' == $query->get( 'post_type' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
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 | |
/** | |
* Plugin Name: Registration Order Link for WooCommerce | |
* Plugin URI: http://skyver.ge/5S | |
* Description: Automatically links previous orders to new customer accounts upon WooCommerce registration. | |
* Author: SkyVerge | |
* Author URI: http://www.skyverge.com/ | |
* Version: 1.0.0 | |
* Text Domain: link-wc-orders | |
* |