Stuart Lambon

Blog — Code Snippets

Advanced customisations to the WordPress WYSIWYG editor

I’ve never really been a fan of content management systems that offer an in-context content editor unless they’re done well on a minimal scale; websites such as Medium do this very well. For most websites with more content and/or with e-commerce capabilities an in-context editor becomes hard to use because they user may get distracted by other parts of the site, lose their place or be bombarded by edit buttons everywhere. I have always preferred content be added the way that WordPress does it; via a back-end interface that focuses the user on what they are writing—in fact in version 4.1 they also added a […]

Read More

Setting a store-wide percentage for PayPal Adaptive Payments on WooCommerce

The WooCommerce PayPal Adaptive Payments plugin is a paid-for WooCommerce extension that allows you to split your PayPal payments between one or more receivers; it supports chained, parallel and simple payments. The extension by default allows you to set these fees on a product-by-product basis but this is a rather laborious and ineffective way of doing things if your store has many products and your fee is always to be the same. Luckily, by using the woocommerce_paypal_ap_payment_args filter you can dynamically assign receivers. The code provided on the documentation page allows you to set up multiple receivers across all products and this solves the […]

Read More

Change the WooCommerce ‘Return to shop’ link

Something I historically struggled to alter with WooCommerce was the ‘Return to shop’ link the customer was presented with upon reaching an empty cart page. The default link sends the customer back to the ‘Shop’ page; this was usually an issue for me as a lot of the websites I worked on were full e-commerce shops and would prefer the customer to be pointed towards perhaps the homepage or a product category page. Perhaps in older versions of WooCommerce it would have sufficed to override a template file in your theme, but I (and probably everyone) should avoid this if possible to make updates […]

Read More