You're browsing category:Handy Code Snippets

Handy Code Snippets / How To / No Plugins Necessary / PHP / WooCommerce

Handy WooCommerce Store PHP Snippets

woocommerce-codesnippets

Here are some Handy WooCommerce Store PHP Snippets that you might find useful… Auto-Complete All WooCommerce Orders 123456789101112/* Auto-Complete All WooCommerce Orders */ add_action( ‘woocommerce_thankyou’, ‘custom_woocommerce_auto_complete_order’ ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( ‘completed’ ); } Set Min/Max Price & Starting Price […]

Handy Code Snippets / How To / PHP / Plugins

List More Custom Field Names

ListMoreCustomFieldNames

First install & activate the List More Custom Field Names plugin. Then add the following code to your functions.php or your custom plugin file.

Handy Code Snippets / How To / No Plugins Necessary / PHP

Handy PHP Snippets for WordPress Sites

php-code-snippets

Here are some very handy PHP snippets I have collected over the years… Use a shortcode inside PHP 1echo do_shortcode('[your_shortcode]’); Only show content to users with a specific role 12345678/* Only show content to users with a specific role */ global $user_login, $current_user; if (is_user_logged_in()) { get_currentuserinfo(); $user_info = get_userdata($current_user->ID); if (in_array(’administrator’, $user_info->roles)) { Send […]