Store close without deactivate cart button. EDD Store Hours Plugin.

Easy Digital Downloads EDD store Hours Plugin is control your store open and close.
https://wordpress.org/plugins/easy-digital-downloads-store-hours/

But this plugin deactivate cart button when close setting is active.

This is inconvenience when you want to test cart button , So I try to custom this plugin.

To be Cart button active even when store is closed

Paste the following code in functions.php of your wordpress theme.

This code can be active cart button even when store is closed.

remove_filter( 'edd_purchase_download_form', 'edd_store_hours_override_purchase_button', 200, 2 );
remove_action( 'edd_pre_add_to_cart', 'edd_store_hours_override_add_to_cart', 200, 2 );

Judgement store conditional using edd_store_hours_is_closed function

<?php if(edd_store_hours_is_closed()): ?>
<!-- This content is displayed when store is closed -->
<?php else: ?>
<!-- This content is displayed when store is open -->
<?php endif; ?>

If you use this method , you can store close without deactivate cart button.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です