Category: Coding

  • Restrict plugin (or all) autoupdates to business hours – WordPress

    Restrict plugin (or all) autoupdates to business hours – WordPress

    We love the plugin autoupdate functionality in WordPress, but we really don’t want them to update on a Saturday night, potentially bringing a site down and messing up our weekend. Update I’ve made this into a downloadable plugin here: https://github.com/a8cteam51/plugin-autoupdate-filter/ When do plugin autoupdates happen? Every time someone hits admin: add_action( ‘admin_init’, ‘_maybe_update_plugins’ ); This function checks if…

  • Filter classic WordPress gallery shortcode attributes

    Filter classic WordPress gallery shortcode attributes

    Use Case We ran an automated import from a Tumblr site to a new WordPress site, and all galleries were imported as gallery shortcodes in classic editor blocks, and they all were set to the default 3 columns and showing thumbnail sizes. We wanted to change the gallery settings on those imported galleries to a…

  • Auto-add free shipping coupon for initial orders only for WooCommerce Subscriptions

    Auto-add free shipping coupon for initial orders only for WooCommerce Subscriptions

    Synopsis Customer wanted to offer free shipping on any orders of at least $25. Additionally, they wanted any subscription renewals to charge shipping normally – the free shipping should only apply to the initial order. To solve this, I’ve suggested using a free shipping coupon, which is applied automatically to the cart if it’s $25…

  • Remove Coupons from Cart with Subscriptions

    Remove Coupons from Cart with Subscriptions

    Remove coupons from cart if there’s a subscription product in it.

  • WooCommerce Subscriptions Restrict Product

    WooCommerce Subscriptions Restrict Product

    Here’s a mini-plugin I wrote which extends the functionality of WooCommerce Subscriptions. It restricts subscription products to a certain number of total active (unended) subscriptions on a site. Use case: store owner wants products and subscriptions to have a one-to-one relationship, i.e. each product should only be subscribed to once. For example, subscription product is…

  • Autocomplete Subscription Renewals WooCommerce

    Autocomplete Subscription Renewals WooCommerce

    The default behavior of WooCommerce is to place orders for physical products in the ‘processing’ status. If you would like to auto-complete all orders with successful payments, including subscription renewals, here’s a free mini-plugin which will do that: https://github.com/jrick1229/woocommerce-subscriptions-auto-complete-orders

  • Confirm WooCommerce Subscriptions Cancellation

    Confirm WooCommerce Subscriptions Cancellation

    We recently witnessed some issues occurring when customers using WooCommerce and Subscriptions deleted their payment methods (when they have a credit card “on file”). When they also have active subscriptions using the card they just deleted, most customers don’t realize that they also have to update their card for each of the active subscriptions. We’ve…

  • Logging errors in WooCommerce

    Logging errors in WooCommerce

    Tracking down errors in PHP can be tricky sometimes, but WordPress and WooCommerce have some built in logging to make it easier. Here are a few snippets for future use: WP_Debug logs First, you need to turn on wp_debug and logging in your wp-config.php file. This will create a debug.log file in your wp-content folder, which…

  • the_date() vs. the_time()

    the_date() vs. the_time()

    These two WordPress functions can be somewhat confusing, and and for good reason: they are nearly identical, and used in similar locations. Both are used to display the publish date (and time) of the post. How are they different? the_date() the_date() will only display the same date once per page. This is designed to be used…

  • Keeping the Web Boring

    Keeping the Web Boring

    There is a lot of temptation to create overly complicated websites. Whether influenced by the client that always wants the page to “pop,” or simply pulled along by the hype train of the latest JavaScript frameworks, it is often too easy to make things unnecessarily complicated. Web developers also tend to be a clever bunch, and…

  • “It’ll be easy…”

    “It’ll be easy…”

    When a client says, “It should be pretty easy and won’t take long,” it invariably means it will be a lengthy and painful slog through all of the seven levels of Hades.

  • The two states of every programmer

    The two states of every programmer

    The two states of every programmer. pic.twitter.com/WU5CZ8EzxR — George Broussard (@georgeb3dr) October 10, 2014