Allow WooCommerce Users to Accept Payments With pay_for_order
PublishPress customers have had some challenging questions for us. In this tutorial, I'm going to explain the answer to a challenging WooCommerce question that came in recently.
One PublishPress customer has a large segment of their customer base wishing to call up and place an order over the phone. To make this happen, they needed to allow users in the “Shop Manager” role to pay for customers. They installed a user switching plugin so that the Shop Managers could log in as the customers and complete the payment.
The problem? Even when the Shop Managers had full control over WooCommerce orders, they could not accept payments. They could not enter credit card or check information when a customer called in to place an order.
After some research, we found the answer in this WooCommerce file: class-wc-shortcodes-checkout.php. This line was controlling access to the order payments:
if ( isset( $_GET['pay_for_order'], $_GET['key'] ) && $order_id )
The solution was to use PublishPress Capabilities, and add
pay_for_order as a capability to the Shop Manager role. In the image below, I've illustrated how to do that: