scrape!
Category Archives: Woocommerce
Log in to the dashboard Go to WooCommerce -> Status Open Tools tab Click “Create default WooCommerce pages” Enjoy!
global $post; $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ($terms as $term) { $product_cat_id = $term->term_id; break; }
add_action(‘admin_head’, ‘hide_updates’); function hide_updates() { if(get_current_user_id()!=1){ echo ‘<style> span.update-plugins{display:none!important;} tr.plugin-update-tr.active {display:none!important} .wrap .notice.notice-error { display: none!important;} </style>’; } }
/** * Display field value on the order edit page */ add_action( ‘woocommerce_admin_order_data_after_billing_address’, ‘my_custom_checkout_field_display_admin_order_meta’, 10, 1 ); function my_custom_checkout_field_display_admin_order_meta($order){ echo ‘This line will appear at the end of order details box’; }
add_action(‘woocommerce_before_cart_table’, ‘automatic_copons’); function automatic_coupons() { global $woocommerce; if( current_user_can(‘administrator’) || current_user_can(‘staff’) || current_user_can(‘editor’)) { $woocommerce->cart->add_discount(‘FreeShipping’); } }
add_filter( ‘woocommerce_available_payment_gateways’, ‘hide_payment_gateway’ ); function hide_payment_gateway( $available_gateways ) { global $woocommerce; if ( isset( $available_gateways[‘cod’] ) && !current_user_can(‘administrator’) && !current_user_can(‘staff’) && !current_user_can(‘editor’) ) { unset( $available_gateways[‘cod’] ); } return $available_gateways; }