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 | |
/** | |
* Registers a meta field as a prepopulation option. | |
*/ | |
function lw_woocommerce_gpf_custom_field_list( $list ) { | |
$list['meta:_wpm_gtin_code'] = 'GTIN field from Product GTIN for WooCommerce plugin'; | |
return $list; | |
} |
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 | |
add_filter( 'woocommerce_gpf_feed_item_google', function ( $feed_item, $product ) { | |
// The regular price of the item. | |
$feed_item->regular_price_ex_tax = 1000; | |
$feed_item->regular_price_inc_tax = 1200; | |
// Set these to NULL if no sale price, or the sale price if required. | |
$feed_item->sale_price_ex_tax = null; | |
$feed_item->sale_price_inc_tax = null; | |
// Set these to the sale price if it exists, otherwise the regular price. |
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 | |
add_filter( 'woocommerce_gpf_shipping_weight_unit', function ( $unit ) { | |
return 'lbs'; | |
}); |
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 | |
add_action( 'init', function() { | |
global $woocommerce_msrp_frontend; | |
remove_action( 'woocommerce_after_shop_loop_item_title', array( $woocommerce_msrp_frontend, 'show_msrp' ), 9 ); | |
}); |
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 | |
add_filter( 'woocommerce_gpf_exclude_product', function ($excluded, $id, $feed_format ) { | |
// Return $excluded to follow the calculated logic. | |
// Return TRUE to exclude a product | |
// Return FALSE to include it. | |
return $excluded; | |
},10, 3 ); |
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 | |
function lw_crfwp_timing_options( $options ) { | |
// 259200 is the number of seconds in 72 hours. | |
$options[259200] = '72 Hours'; | |
return $options; | |
} | |
add_filter( 'crfwp_timing_options', 'lw_crfwp_timing_options' ); |
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 | |
function lw_woocommerce_gpf_feed_item_google( $feed_item, $product ) { | |
// Modify $feed_item->additional_elements['product_type'] here, e.g. | |
$feed_item->additional_elements['product_type'] = [ | |
'Product ID ' . $product->get_id(), | |
]; | |
return $feed_item; | |
} | |
add_filter( 'woocommerce_gpf_feed_item_google', 'lw_woocommerce_gpf_feed_item_google', 10, 2 ); |
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 | |
add_filter( 'crfwp_discount_code_expiry_options', function( $options ) { | |
$options['864000'] = array( | |
'value' => '864000', // Length discount code is valid for (in seconds) | |
'selected' => '', // Leave blank | |
'description' => __( 'Ten days', 'crfwp' ), // Description of discount edpiry period | |
); | |
return $options; | |
} ); |
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 | |
add_filter( 'woocommerce_gpf_wc_get_products_args', function ($args) { | |
// Modify the query args here. | |
return $args; | |
}); |
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 | |
add_filter( 'woocommerce_gpf_include_variations', function ($include_variations, $wc_product) { | |
// Return true if you want to include variations for this $wc_product | |
// Return false if you do not want to include variations for this $wc_product | |
// Return $include_variations to honour the standard behaviour according to the extension settings. | |
return $include_variations; | |
}, 10, 2 ); |