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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
/** | |
** Get the store details and add them to order email | |
** below the order table | |
** WC Pickup Store plugin | |
** https://wordpress.org/plugins/wc-pickup-store/ | |
**/ | |
function custom_order_details_after_order_table($order) { | |
$order_id = $order->get_id(); | |
$store_name = get_post_meta($order_id, '_shipping_pickup_stores', true); // Get store title for this order |
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 | |
/** | |
** Adding superscript to wc_price <sup></sup> | |
** not working with prices into select2 | |
**/ | |
function custom_custom_price_format($return, $price, $args, $unformatted_price) { | |
$elements = explode('.', $price); | |
if(is_admin()) { | |
return $return; |
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
/** | |
** After update checkout | |
**/ | |
$(document.body).on('update_checkout, updated_checkout', function () { | |
validate_checkout_required_fields(); | |
}); | |
function validate_checkout_required_fields() { | |
if($('select.shipping_method').val() == "wc_pickup_store") { | |
$('#billing_state_field, #billing_city_field, #billing_address_1_field').find(".required").hide(); |
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 wc_removing_customer_details_in_emails($order, $sent_to_admin, $plain_text, $email) { | |
if ($order->has_shipping_method('wc_pickup_store')) { | |
$mailer = WC()->mailer(); | |
remove_action( 'woocommerce_email_customer_details', array( $mailer, 'email_addresses' ), 20, 3 ); | |
} | |
} | |
add_action('woocommerce_email_customer_details', 'wc_removing_customer_details_in_emails', 5, 4); |
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 extra information to admin order actions column | |
** @keylocr - 29-01-2020 | |
**/ | |
function wc_custom_admin_order_actions_end($object) { | |
$order_id = $object->get_id(); | |
$store = (!empty(get_post_meta($order_id, '_shipping_pickup_stores', true))) ? get_post_meta($order_id, '_shipping_pickup_stores', true) : ''; | |
if(!empty($store)) : |
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 new content to be displayed in the template of store information in the Checkout page | |
* | |
* @author: @keylorcr | |
* @version 1.5.23 | |
*/ | |
function kmchild_wps_stores_fields($the_fields) { | |
foreach ($the_fields as $store_id => $value) { | |
$the_fields[$store_id][] = array( |
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 | |
/** | |
* Adding custom json locations from child theme | |
* WC Provincia-Canton-Distrito | |
*/ | |
function kmchild_prov_cant_dist_json($json_file) { | |
$json_file = get_stylesheet_directory_uri() . '/assets/js/prov-cant-dist.json'; | |
return $json_file; | |
} |
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 | |
/** | |
* Change shipping method priority | |
* Use array_unshift for the beginnig and array_push onto the end of array | |
*/ | |
function kmchild_sort_shipping_methods($available_shipping_methods, $package) { | |
if (isset($available_shipping_methods['wc_pickup_store'])) { | |
$wc_pickup_store = $available_shipping_methods['wc_pickup_store']; | |
unset($available_shipping_methods['wc_pickup_store']); | |
// array_unshift($available_shipping_methods, $wc_pickup_store); // Prepend element to the beginning of array |
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 | |
/** | |
** The template for displaying archive store post type | |
** Current version: 1.5.13 | |
**/ | |
get_header(); ?> | |
<div id="primary" class="content-area"> | |
<header class="entry-header"> | |
<h1 class="wps-title page-title"><?= post_type_archive_title() ?></h1> |