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
| add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
| function wc_custom_redirect_after_purchase() { | |
| global $wp; | |
| if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
| $order_id = absint( $wp->query_vars['order-received'] ); | |
| $order_key = wc_clean( $_GET['key'] ); | |
| /** | |
| * Replace {PAGE_ID} with the ID of your page |
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
| // Fade in | |
| .some-element { | |
| -webkit-animation: fadein 2s; | |
| -ms-animation: fadein 2s; | |
| animation: fadein 2s; | |
| } | |
| @-webkit-keyframes fadein { | |
| from { |
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
| rest_avatar_sizes | |
| rest_prepare_attachment | |
| rest_pre_insert_comment | |
| rest_comment_type_trashable | |
| comment_text |
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
| var $product = $('#product'); | |
| var $bookingForm = $product.find('.cart'); | |
| var $picker = $bookingForm.find('.picker'); | |
| var $resources = $('#resources'); | |
| function checkAvailability( el ) { | |
| var fully_booked_ids = []; | |
| var jsonArray = el.data( 'fully-booked-days' ); | |
| var booking_date_year = $bookingForm.find('#booking_date_year').val(); |
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
| function get_product_availability() { | |
| global $product, $post; | |
| // Get dates from custom field | |
| $start_date = get_field('start_date'); | |
| $end_date = get_field('end_date'); | |
| // Get into class | |
| $WC_Product_Booking = new WC_Product_Booking($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 | |
| add_action( 'woocommerce_order_status_completed', 'mark_confirm_bookings', 20, 1 ); | |
| function mark_confirm_bookings( $order_id ) { | |
| global $wpdb; | |
| $order = new WC_Order( $order_id ); | |
| $bookings = array(); | |
| foreach ( $order->get_items() as $order_item_id => $item ) { |
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
| (function(window, document){ | |
| 'use strict'; | |
| var slice = [].slice; | |
| var removeClass = function(elem){ | |
| elem.classList.remove('focus-within'); | |
| }; | |
| var update = (function(){ | |
| var running, last; | |
| var action = function(){ | |
| var element = document.activeElement; |
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: Order Form for WooCommerce extend form | |
| Plugin URI: https://gist.github.com/webaware/1fe598e60f9ad9a912ee | |
| Description: example form extras using hooks | |
| Author: WebAware | |
| Author URI: http://webaware.com.au/ | |
| */ | |
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
| <!-- ... --> | |
| <p>{{data.pageTitle}}</p> | |
| <ul> | |
| <li ng-repeat="post in data.posts"> | |
| <a href="blog/{{post.ID}}" ng-bind-html="post.title"></a> | |
| <a href="blog/{{post.ID}}" ng-if="post.featured_image.attachment_meta.sizes.thumbnail.url"><img ng-src="{{post.featured_image.attachment_meta.sizes.thumbnail.url}}" alt="{{post.featured_image.title}}" /></a> | |
| <div ng-bind-html="post.excerpt"></div> | |
| </li> | |
| </ul> |
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
| // Add this to your child theme's functions.php file | |
| function wc_custom_cart_thumb( $thumb, $cart_item ) { | |
| return get_the_post_thumbnail( $cart_item['product_id'], 'shop_thumbnail' ); | |
| } | |
| add_filter( 'woocommerce_cart_item_thumbnail', 'wc_custom_cart_thumb', 10, 2 ); |