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
function wc_ninja_manipulate_shipping( $rates, $package ) { | |
// All available rates and their costs | |
//print_r($rates); | |
// All products in the cart and their costs | |
//print_r($package); | |
// Example of manipulating the cost of | |
// a shipping method based on the above variables. | |
if ( isset( $rates['flat_rate'] ) ) { |
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
/** | |
* Add custom status to order list | |
*/ | |
add_action( 'init', 'register_custom_post_status', 10 ); | |
function register_custom_post_status() { | |
register_post_status( 'wc-backorder', array( | |
'label' => _x( 'Back Order', 'Order status', 'woocommerce' ), | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, |
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
Show hidden characters
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for JSHint[1] setting | |
// config values to be most strict: | |
// | |
// * set all enforcing options to true | |
// * set all relaxing options to false |
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 strict"; | |
(function ($) { | |
/** | |
* Detects all component attributes that have only a single value option and adds the '.single-choice' class | |
* to the respective table row. Additionally, a <span> with the class '.single-choice-label' is added, containing | |
* the options name. | |
* | |
* If executed twice, the previous changes are reverted first (in order to account for possible scenario changes). | |
* Default values or previous selections are saved and restored if the option becomes available again. |
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 | |
/** | |
* Return an array of restricted shipping locations for WooCommerce | |
* | |
* Restricted locations include Alaska, American Samoa, Guam, Hawaii, North Mariana Islands, Puerto Rico, | |
* US Minor Outlying Islands, and the US Virgin Islands | |
* | |
* @return 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
{ | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "advanced-custom-fields/advanced-custom-fields-pro", | |
"version": "5.0", | |
"type": "wordpress-plugin", | |
"dist": { | |
"type": "zip", |
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 lynt_is_en() { | |
$path_parts = explode('/', $_SERVER['REQUEST_URI']); | |
if (isset($path_parts[1]) && $path_parts[1] === 'en') { | |
return true; | |
} | |
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
add_filter('manage_edit-shop_order_columns', 'wc_custom_purchased_column'); | |
function wc_custom_purchased_column($columns) | |
{ | |
$new_array = array(); | |
foreach ($columns as $key => $title) { | |
if ($key == 'billing_address') { | |
$new_array['order_items'] = __('Purchased', 'woocommerce'); | |
} |
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 | |
/** | |
* Remove user list endpoint from rest api | |
*/ | |
add_filter('rest_endpoints', function($aryEndpoints){ | |
if(isset($aryEndpoints['/wp/v2/users'])){ | |
unset($aryEndpoints['/wp/v2/users']); | |
} | |
if(isset($aryEndpoints['/wp/v2/users/(?P<id>[\d]+)'])){ | |
unset($aryEndpoints['/wp/v2/users/(?P<id>[\d]+)']); |
OlderNewer