Skip to content

Instantly share code, notes, and snippets.

@SashkoWooTeam
SashkoWooTeam / jet-woo-builder-and-wcbm-compatibility.php
Created August 22, 2019 12:24
JetWooBuilder and Yith Shop Badges compatibility
if ( !function_exists( 'yith_wcbm_shop_badge_container_start' ) && !function_exists( 'yith_wcbm_shop_badge_container_end' ) ) {
add_action( 'jet-woo-builder/templates/products/before-item-thumbnail', 'yith_wcbm_shop_badge_container_start', 1 );
add_action( 'jet-woo-builder/templates/products/before-item-thumbnail', 'yith_wcbm_shop_badge_container_end', 2 );
function yith_wcbm_shop_badge_container_start() {
do_action( 'yith_wcbm_theme_badge_container_start' );
}
function yith_wcbm_shop_badge_container_end() {
do_action( 'yith_wcbm_theme_badge_container_end' );
}
}
@SashkoWooTeam
SashkoWooTeam / open-popup-after-wc-update-cart.js
Created August 7, 2019 08:54
Open Jet Popup on WooCommerce Update Cart action
$( document ).on( 'wc_update_cart added_to_cart', function() {
var popupId = 'jet-popup-1455';
$( window ).trigger( {
type: 'jet-popup-open-trigger',
popupData: {
popupId: popupId
}
} );
});
@SashkoWooTeam
SashkoWooTeam / jet-smart-filters-wholesale-pro-compatibility.php
Created July 30, 2019 11:16
JetSmartFilters compatibility with Wholesale Pro
add_action( 'jet-smart-filters/provider/epro-archive-products/before-ajax-content', 'theme_name_jet_smart_filters_compatibility' );
function theme_name_jet_smart_filters_compatibility() {
if ( class_exists( 'IGN_Wholesale_Pro_Suite' ) ) {
$settings = get_option( 'woocommerce_ignitewoo_wholesale_pro_suite_settings' );
if ( ! empty( $settings['login_required_for_prices'] ) && 'yes' == $settings['login_required_for_prices'] && ! is_user_logged_in() ) {
if ( wp_doing_ajax() ) {
@SashkoWooTeam
SashkoWooTeam / jet-smart-filters-change-tax-operator.php
Created July 23, 2019 09:58
Set tax query operator for some taxonomies
function jet_set_compare_operator( $query ) {
// Change Tax Query operator
$tax_key = 'tax_name';
$operator = 'AND';
if ( ! empty( $query['tax_query'] ) ) {
foreach ( $query['tax_query'] as $key => $tax_query_row ) {
add_filter( 'jet-woo-builder/shortcodes/jet-woo-products/query-args', 'oceanwp_jet_woo_products_query_args' );
if ( ! function_exists( 'oceanwp_jet_woo_products_query_args' ) ) {
function oceanwp_jet_woo_products_query_args( $args ) {
if ( $outofstock_term = get_term_by( 'name', 'outofstock', 'product_visibility' ) ) {
$args['tax_query'][] = array(
'taxonomy' => 'product_visibility',
'field' => 'term_taxonomy_id',
@SashkoWooTeam
SashkoWooTeam / jet_smart_filters_astra_compatibility.php
Last active April 2, 2021 12:06
Add JetSmartFilters compatibility with Asrta Theme
add_action( 'jet-smart-filters/providers/epro-archive-products/before-ajax-content', 'jet_smart_filters_astra_compatibility', 1 );
function jet_smart_filters_astra_compatibility(){
if( class_exists( 'Astra_Woocommerce' ) ){
$astra = new Astra_Woocommerce();
if ( ! apply_filters( 'astra_woo_shop_product_structure_override', false ) ) {
$astra->shop_customization();
}
@SashkoWooTeam
SashkoWooTeam / jet-engine-wc-csv-import-export.php
Created June 14, 2019 07:52
Adding Custom Import/Export Columns (WooCommerce CSV)
/**
* Add the custom column to the exporter and the exporter column menu.
*
* @param array $columns
* @return array $columns
*/
function jet_engine_add_wc_export_column( $columns ) {
// column slug => column name
$columns['product_custom_text'] = 'Product Custom Text';
@SashkoWooTeam
SashkoWooTeam / jet-smart-filters-data.php
Created April 24, 2019 15:12
Exclude terms from filter example
add_filter( 'jet-smart-filters/data/terms-objects', 'jet_smart_filters_exclude_terms', 10, 3 );
function jet_smart_filters_exclude_terms( $options, $tax, $child_of_current ){
// $tax_for_filters slug of taxonomy that used in filter
$tax_for_filters = 'product_cat';
// the terms ids that need to exclude and their descendants
$terms_for_exclude = array( 36 );
if( $tax_for_filters !== $tax ){