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 | |
| // Update shipping class if a specific field has any value | |
| // Uncomment line below if you want to check the field for a specific value | |
| add_action( 'woocommerce_before_calculate_totals', function( $cart ) { | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
| return; | |
| } | |
| $target_field_id = 1642; // the field ID | |
| $shipping_class = 'easy'; // the shipping class slug |
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 | |
| /** | |
| * Flat rate with daily overage for Bookings for WooCommerce | |
| * | |
| * When a product has the "Flat rate" option enabled, charges the flat rate | |
| * for bookings up to $min_days, then adds $daily_rate | |
| * for each additional day beyond that. | |
| * | |
| * Add to your theme's functions.php or a site-specific plugin. | |
| * |
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 | |
| /** | |
| * Set migration to done for Dynamic Pricing and Discount Rules | |
| */ | |
| add_filter( 'wcfad_assume_migration_done', '__return_true' ); |
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 | |
| /** | |
| * Subtract last day's cost from daily booking | |
| * Requires bookings to be a minimum of 2 days | |
| */ | |
| function demo_dont_charge_last_day( $booking_cost, $product_id ) { | |
| $std_cost = bfwc_get_standard_cost( $product_id ); | |
| $booking_cost = $booking_cost - $std_cost; | |
| return $booking_cost; | |
| } |
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_action( 'wp_footer', function(){ | |
| ?> | |
| <script> | |
| jQuery( document ).ready( function(){ | |
| jQuery( document.body ).on( 'woosq_loaded', function( event, id ){ | |
| jQuery( 'body' ).trigger( 'pewc_check_conditions' ).trigger('pewc_trigger_calculations'); | |
| jQuery( 'body' ).trigger( 'pewc_reinitiate_js_validation' ); | |
| jQuery( 'body' ).trigger( 'pewc_attach_form_cart_input_change' ); | |
| jQuery( 'body' ).trigger( 'pewc_trigger_initial_check' ); |
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 | |
| /** | |
| * If a product has an alternative featured image, display that on the archive page | |
| */ | |
| function pr_demo_product_get_image( $image, $product, $size, $attr, $placeholder ) { | |
| if( is_product() ) { | |
| // We're on a product page so just return the image | |
| return $image; | |
| } | |
| $product_id = $product->get_id(); |
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
| .pewc-has-hex .pewc-radio-images-wrapper img { | |
| visibility: visible; | |
| height: auto; | |
| } | |
| .pewc-hex { | |
| display: none; | |
| } |
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 | |
| /** | |
| * Filter the available fonts for each text preview field | |
| * List fonts in arrays using 'abel' => 'Abel' key / value pairs | |
| * Update the field IDs to match your own | |
| */ | |
| function demo_filter_all_fonts( $all_fonts, $available_fonts, $field ) { | |
| // Update the field IDs below to match your field IDs | |
| if( $field['field_id'] == 1209 ) { |
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 a shortcode using a hook | |
| */ | |
| function pr_add_shortcode_after_product_summary() { | |
| echo do_shortcode( '[product_category category="hoodies" columns="3" limit="6"]' ); | |
| } | |
| add_action( 'woocommerce_after_single_product_summary', 'pr_add_shortcode_after_product_summary', 5 ); |
NewerOlder