Skip to content

Instantly share code, notes, and snippets.

\\script para gerar e salvar um pdf dentro do drive.
function onOpen() {
SpreadsheetApp
.getUi()
.createMenu('Gerar PDF')
.addItem('Gerar PDF', 'printpdf')
.addToUi();
/**
* Add custom column (Custo) to shop_order post type
*/
function add_custom_column_to_wc_orders_list($columns){
$new_columns = (is_array($columns)) ? $columns : array();
$new_columns['wc_cog_order_total_cost'] = __('Custo');
return $new_columns;
}
add_filter('manage_edit-shop_order_columns', 'add_custom_column_to_wc_orders_list');
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
if( is_cart() || is_checkout() ) {
global $woocommerce;
$minimum_cart_total = 31;
$total = WC()->cart->subtotal;
if( $total <= $minimum_cart_total ) {
# WPSINGLE BASIC NGINX CONFIGURATION
server {
server_name ebeard.com.br www.ebeard.com.br;
access_log /var/log/nginx/ebeard.com.br.access.log rt_cache;
error_log /var/log/nginx/ebeard.com.br.error.log ;
root /var/www/ebeard.com.br/htdocs;
index index.php index.htm index.html;
/**
* Add new register fields for WooCommerce registration.
*
* @return string Register fields HTML.
*/
function cs_wc_extra_register_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_billing_first_name"><?php _e( 'Nome', 'textdomain' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
/**
* WooCommerce
* --------------------------
* Remover a barra de admin dos clientes
*/
if (!current_user_can('administrator')):
show_admin_bar(false);
endif;
<?php
/**
* Order product collections by stock status, instock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
/**
* WooCommerce
* --------------------------
* redireionar direto para o carrinho depois de click em comprar
*/
function redirect_cart_to_checkout() {
wp_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) );
exit;
}
<?php
// Begin Custom Scripting to Move JavaScript from the Head to the Footer
function remove_head_scripts() {
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
add_action('wp_footer', 'wp_print_scripts', 5);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
define ( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_MEMORY_LIMIT','128M' );
define('WP_POST_REVISIONS' false);