I got this ida from Kevin Elliott's list at https://gist.github.com/kevinelliott/e12aa642a8388baf2499
- Browsers
- Chrome
- Firefox
- Utilities
<?php | |
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1); | |
function filter_gateways( $gateways ) { | |
$method = WC()->session->get( 'chosen_shipping_methods' ); | |
// get the value of the radio button on the checkout page | |
if ( 'flat_rate:1' != $method[0] ) { | |
unset( $gateways['paypal'] ); | |
} |
<?php | |
echo "START\n"; | |
$file_name ='IMG_2869.JPG'; | |
$exif = exif_read_data( $file_name, 'IDF0' ); | |
echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n"; | |
$exif = exif_read_data( $file_name, 0, true ); | |
echo "$file_name:\n"; |
<?php | |
/** | |
* This can be run by wp-cli to trigger an email send. | |
* The email is determined by the action. The one below will trigger the "new order email" | |
*/ | |
WC()->mailer(); | |
$order_id = '260'; // this order needs to exist in your store | |
$args = array( 'order_id' => $order_id ); |
I got this ida from Kevin Elliott's list at https://gist.github.com/kevinelliott/e12aa642a8388baf2499
<?php | |
echo "START\n"; | |
// Setup arguments for WP_Query | |
// set post type to WooCommerce orders | |
// set post status to published | |
// set fields to return just the post IDs | |
// set posts per page to -1 so all records are returned | |
$args = array( |
<?php | |
add_shortcode( 'random_products', 'growdev_random_products' ); | |
function growdev_random_products( ) { | |
$meta_query = WC()->query->get_meta_query(); |
<?php | |
// add qty to cart to trigger dynamic pricing | |
$cart_item_key = WC()->cart->add_to_cart('8','300'); | |
$product = wc_get_product( '8' ); | |
echo "NAME: " . $product->get_title() . "\n"; | |
$price = $product->get_price(); | |
echo "PRICE: " . $price . "\n"; |
<? | |
/* Add this to your theme's functions.php to move the variation description display to a different location | |
* on the product page. | |
*/ | |
add_action('plugins_loaded', 'move_variation_description', 50); | |
function move_variation_description(){ | |
// Remove the hook from the original location |
<?php | |
if ( function_exists( 'EDD_Enhanced_Ecommerce_Tracking' ) ) { | |
remove_action( 'wp_footer', array( EDD_Enhanced_Ecommerce_Tracking()->front_end, 'print_js_tracking_code' ) ); | |
} |
<?php | |
/** | |
* This code snippet adds a "Active Subscriber" Yes/No to the conditional box of WooCommerce Advanced Messages. | |
* You can use this to display messages to customers with an active subscription. | |
*/ | |
/** | |
* Add the option to the condition drop down |