bobbingwide / vgc

VGC - Garden Vista Group theme
GNU General Public License v2.0
0 stars 0 forks source link

Add support for Deposits & Partial Payments for WooCommerce by Acowebs #29

Closed bobbingwide closed 10 months ago

bobbingwide commented 2 years ago

The WooCommerce Deposits plugin allows the store owner to mark items as deposit items which customers can then place deposits on, rather than paying in full.

With the current theme this product doesn't work at all. WooCommerce support suggested trying Storefront. I'm pretty certain it would have worked with Storefront. But then none of the optional addon logic would have worked.

Observations

bobbingwide commented 1 year ago

Yasmin has found two other plugins to try:

plus there's:

She suggests trying them in the order listed above. The solution needs to be compatible with WooCommmerce 7.4.0 and above.

Requirements

bobbingwide commented 1 year ago

Deposits & Partial Payments for WooCommerce by Acowebs works with the standard templates but not the VGC theme.

In a standard theme the user gets told about the Deposit and Future payments on:

bobbingwide commented 1 year ago

Bayna - Deposits & Partial Payments for WooCommerce doesn't appear to have a default percentage field. It may be in the Pro version.

In a standard theme the user gets told about the Deposit and Future payments on:

Notes

It doesn't work at all in a Windows installation a symlinked plugin.

bobbingwide commented 1 year ago

WooCommerce deposits was orignally purchased from WooCommerce.

bobbingwide commented 1 year ago

Advanced Partial/Deposit Payment For Woocommerce

Warning: Undefined array key "mepp_text_translation_string_payment_date" in C:\apache\htdocs\wordpress\wp-content\plugins\advanced-partial-payment-or-deposit-for-woocommerce\inc\class_admin_menu.php on line 110

In a standard theme the user gets told about the Deposit and Future payments on:

Notes

bobbingwide commented 1 year ago

Deposits and Partial Payments for WooCommerce partially works on the Cart display.

image

The deposit total doesn't include the Add-Ons.

The filter functions for woocommerce_get_item_data are

: 10 AWCDP_Front_End::awcdp_get_item_data;2 display_addon_info_in_cart;2

We should try setting the priority for display_addon_info_in_cart to 9.

bobbingwide commented 1 year ago

That didn't work other than moving the Deposit Amount and Future payments below the Product Addons. The Deposit Amount was still based on the base product price, not the price including the addons.

This product price is set when the product is added to the cart. We need to look at the hooks attached to woocommerce_add_cart_item_data.

Attached hooks are

: 10 AWCDP_Front_End::awcdp_add_cart_item_data;3 calculate_price_on_cart_addition;2

Try setting the priority for calculate_price_on_cart_addition to 9

That didn't work since the VGC theme uses $cart_item_data['custom_price'] instead of the product price. It would appear that we need to override the product price that's used by the plugin.

One way to achieve this might be to add another hook that adjusts the figures determined by awcdp_add_cart_item_data, or change woocommerce_add_cart_item_data and leave it a priority 10, or increase it to 11 to be on the safe side.

bobbingwide commented 1 year ago

No, that doesn't work since awcdp_add_cart_item_data only sets the the cart item data to

  [awcdp_deposit] => Array

        [enable] => (boolean) 1

at this time. The values are updated later on.

bobbingwide commented 1 year ago

Try adding a hook for woocommerce_add_to_cart to set a different value for the cart item's ['awcdp_deposit'] ['original_price'] ( originally set by awcdp_save_original_price() ) to the value for the cart item's ['custom_price'].

That worked. This screenshot shows 2 products in the cart. image

It may not be necessary to display the Deposit Amount and Future Payments in the Product column as

  1. this is shown in the Price Summary
  2. and we don't expect customers to be ordering more than one product at a time.
bobbingwide commented 1 year ago

On my local Checkout the order looks like this. image

Again, the Deposit Amount and Future Payments details lines aren't really necessary when there's only one product in the cart

bobbingwide commented 1 year ago

The order-received page shows the same stuff image

Note there are two payments based on the order number

bobbingwide commented 1 year ago

I don't yet know what happens after the first partial payment has been made. It depends on the current processes regarding payment.

bobbingwide commented 1 year ago

The latest requirements ( Feb 2023 ) are:

Requirements

Proposed solution

Use the Deposits & Partial Payments for WooCommerce plugin, by Acowebs

The following changes to the default processing are to be applied in the VGC theme.

bobbingwide commented 1 year ago

Testing

I changed my test product to 25% deposit. I also set the sale date from 1st to 2nd March 2023. The figure of 25% overrides the default 10%.

image

I changed one Halls product to not support deposits ( Enable Deposit -> No )

image

Note: The Deposits fields ( Enable Deposit, Deposit type and Deposit Amount ) are not available in Bulk Edit. Enable Deposit will have to be set manually for each products in the Halls brand.

bobbingwide commented 1 year ago

Testing with VGC v1.4.0

image

bobbingwide commented 1 year ago

I needed to change the General settings > Default selection to Pay deposit in order to get it to work.

For the time being I've reset the default to Pay full until the Halls products are individually updated to Enable Deposit No image

bobbingwide commented 1 year ago

The first version is configured so that all products which support deposits are added as Pay Deposit. The requirement is, for products which support deposits, to allow the user to decide when they add the product to the cart.

This would require changes to the single product display:

bobbingwide commented 1 year ago

In a default theme the plugin displays a radio button before the Add to cart button. image

This sets an input field of name awcdp_deposit_option to yes or no, depending on the radio button selected.

The plugin hooks into

add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'awcdp_get_deposit_container' ), 999 );
bobbingwide commented 1 year ago

to provide two add to cart buttons and logic

If we add a call to do_action( 'woocommerce_before_add_to_cart_button' ) in woocommerce/content-single-product.php just before the Add to cart button then the plugin displays the radio buttons. image

Since this is invoking the plugin's standard logic the plugin's settings for Default selection, and overrides for individual products are respected.

Adding the product to the cart produces the expected results in the cart. This carries forward to checkout.

to dynamically calculate the deposit in the browser.

This is not necessary.

for the server end to correctly detect the payment amount selected

The plugin does this.

.... We just need to consider styling the radio buttons.

bobbingwide commented 1 year ago

... We just need to consider styling the radio buttons.

This can be done by removing the frontent stylesheet enqueued by the plugin and adding a bottom margin to the section that displays the Cart total. image

when the user selects the Pay deposit radio button the deposit percentage appears image It disappears again if the Pay full amount radio button is chosen.

bobbingwide commented 1 year ago

when the user selects the Pay deposit radio button the deposit percentage appears

If the default is Pay deposit then it appears immediately. This is the screen capture from testing in Live.

image

bobbingwide commented 10 months ago

Delivered in v1.5.1