<?php
add_action( 'woocommerce_before_add_to_cart_quantity', 'bbloomer_display_dropdown_variation_add_cart' );
function bbloomer_display_dropdown_variation_add_cart() {
global $product;
if ( $product->is_type('variable') ) {
?>
<script>
jQuery(document).ready(function($) {
$('input.variation_id').change( function(){
if( '' != $('input.variation_id').val() ) {
var holidayArray = ['1-1','1-5','8-5','5-7','6-7','28-9','28-10','17-11','24-12','25-12','26-12']; /*Czech public holidays in the format "day-month" */
var myDate = new Date(); /*Get today's date*/
var easterMonth;
var easterDay;
/* Calculate Easter Friday as per https://en.wikipedia.org/wiki/Date_of_Easter */
var year = myDate.getFullYear();
var a = year % 19;
var b = year % 4;
var c = year % 7;
var k = Math.floor(year/100);
var p = Math.floor((13 + 8*k)/25);
var q = Math.floor(k/4);
var M = (15 - p + k - q) % 30;
var N = (4 + k - q) % 7;
var d = (19*a + M) % 30;
var e = (2*b + 4*c + 6*d + N) % 7;
easterDay = ((d + e - 9) > 0) ? (d + e - 9) : (22 + d + e);
easterMonth = ((d + e - 9) > 0) ? 4 : 3;
if (easterDay == 26 && easterMonth == 4)
easterDay = 19; /*Correction for historical reasons*/
var easterSunday = new Date(easterDay + "/" + easterMonth + "/" + year);
var easterMonday = new Date(easterSunday.getTime());
easterMonday.setDate(easterMonday.getDate() + 1); /*Shift by 1 day to get Easter Monday*/
holidayArray.push(easterMonday.getDate() + '-' + (easterMonday.getMonth() + 1));
var easterFriday = new Date(easterSunday.getTime());
easterFriday.setDate(easterFriday.getDate() - 2); /*Shift back by 2 days to get Easter Friday*/
holidayArray.push(easterFriday.getDate() + '-' + (easterFriday.getMonth() + 1));
do myDate.setDate(myDate.getDate() + 1);
while (myDate.getDay() == 6 || myDate.getDay() == 0 || holidayArray.includes(myDate.getDate() + '-' + (myDate.getMonth() + 1) ))
$("p.in-stock").text('Skladem. Odesíláme ' + myDate.toLocaleDateString());
}
});
});
</script>
<?php
}
}
Cookie | Duration | Description |
---|---|---|
__stripe_mid | 1 year | Stripe sets this cookie cookie to process payments. |
__stripe_sid | 30 minutes | Stripe sets this cookie cookie to process payments. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
elementor | never | This cookie is used by the website's WordPress theme. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_gh_sess | session | GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form. |
Cookie | Duration | Description |
---|---|---|
_octo | 1 year | No description available. |
logged_in | 1 year | No description available. |
m | 2 years | No description available. |
TDPrJV | 1 day | No description |
wNiYbt | 1 day | No description |