Skip to content

Instantly share code, notes, and snippets.

@odirlon
odirlon / filter-wc-orders-by-gateway.php
Created Mar 20, 2020 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
View filter-wc-orders-by-gateway.php
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
@odirlon
odirlon / remove-woocommerce-submenu-items
Created Jun 4, 2019 — forked from WillBrubaker/remove-woocommerce-submenu-items
Remove WooCommerce submenu items for Shop Managers
View remove-woocommerce-submenu-items
<?php
/*
Don't copy the opening php tag
*/
/*
Removes submenu items from WooCommerce menu for 'Shop Managers'
available submenu slugs are:
wc-addons - the Add-ons submenu
wc-status - the System Status submenu
@odirlon
odirlon / code.php
Created Sep 27, 2018 — forked from luizbills/code.php
Disable 'manage_stock' in REST API for variable products
View code.php
<?php
add_filter( 'woocommerce_rest_pre_insert_product_object', 'lpb_wc_disable_magage_stock_in_rest_api', 10, 2 );
function lpb_wc_disable_magage_stock_in_rest_api ( $product, $request ) {
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) && $product->is_type( 'variable' ) ) {
if ( isset( $request['manage_stock'] ) && $request['manage_stock'] ) {
unset( $request['manage_stock'] );
$product->set_manage_stock( false );
}
}
View Cadastrar campos na tela de registro.
/*
* Validate the extra register fields.
*
* @param WP_Error $validation_errors Errors.
* @param string $username Current username.
* @param string $email Current email.
*
* @return WP_Error
*/