Version Description
- Fix: woocommerce checkout remove field based on categories
Download this release
Release Info
| Developer | quadlayers |
| Plugin | |
| Version | 4.4.2 |
| Comparing to | |
| See all releases | |
Code changes from version 4.4.1 to 4.4.2
- includes/templates/functions/billing_functions.php +606 -619
- new/fields_handler.php +73 -14
- new/fields_register.php +3 -1
- readme.txt +4 -1
- woocommerce-checkout-manager.php +2 -2
includes/templates/functions/billing_functions.php
CHANGED
|
@@ -2,367 +2,369 @@
|
|
| 2 |
/**
|
| 3 |
* WooCommerce Checkout Manager
|
| 4 |
*/
|
| 5 |
-
|
| 6 |
// Exit if accessed directly
|
| 7 |
-
if (
|
|
|
|
| 8 |
|
| 9 |
function wooccm_billing_hide_required() {
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
<style>
|
| 26 |
';
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
p#billing_'
|
| 31 |
display:none;
|
| 32 |
}';
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
</style>';
|
| 37 |
-
|
| 38 |
-
|
| 39 |
}
|
| 40 |
|
| 41 |
function wooccm_billing_scripts() {
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
<script type="text/javascript">
|
| 58 |
jQuery(document).ready(function() {
|
| 59 |
var today = new Date();
|
| 60 |
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
| 61 |
-
jQuery("input#billing_'
|
| 62 |
';
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
});
|
| 109 |
}
|
| 110 |
});
|
| 111 |
</script>
|
| 112 |
';
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
showPeriod: true,';
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
hours: { starts: '
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
minutes: {interval: '
|
| 125 |
-
|
| 126 |
-
|
| 127 |
showLeadingZero: true';
|
| 128 |
-
|
| 129 |
-
|
| 130 |
<!-- Billing section: TimePicker -->
|
| 131 |
<script type="text/javascript">
|
| 132 |
jQuery(document).ready(function() {
|
| 133 |
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
| 134 |
-
jQuery("#billing_'
|
| 135 |
';
|
| 136 |
-
|
| 137 |
-
|
| 138 |
});
|
| 139 |
}
|
| 140 |
});
|
| 141 |
</script>
|
| 142 |
';
|
| 143 |
-
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
| 147 |
<script type="text/javascript">
|
| 148 |
jQuery(document).ready(function() {
|
| 149 |
-
jQuery("p#billing_'
|
| 150 |
});
|
| 151 |
</script>
|
| 152 |
';
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
?>
|
| 160 |
-
<script type="text/javascript">
|
| 161 |
-
jQuery(document).ready(function($) {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
});
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
// ============================== radio button & checkbox ===========================================
|
| 204 |
|
| 205 |
-
|
| 206 |
-
?>
|
| 207 |
-
<script type="text/javascript">
|
| 208 |
-
jQuery(document).ready(function($) {
|
| 209 |
-
|
| 210 |
-
<?php if(
|
| 211 |
-
|
| 212 |
-
<?php } ?>
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
});
|
| 231 |
-
</script>
|
| 232 |
-
<?php
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
?>
|
| 237 |
-
<script type="text/javascript">
|
| 238 |
-
jQuery(document).ready(function($) {
|
| 239 |
-
|
| 240 |
-
<?php if(
|
| 241 |
-
|
| 242 |
-
<?php } ?>
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
});
|
| 260 |
-
</script>
|
| 261 |
-
<?php
|
| 262 |
-
|
| 263 |
|
| 264 |
// =========================================== select options =========================================
|
| 265 |
|
| 266 |
-
|
| 267 |
-
?>
|
| 268 |
-
<script type="text/javascript">
|
| 269 |
-
jQuery(document).ready(function($) {
|
| 270 |
-
|
| 271 |
-
<?php if(
|
| 272 |
-
|
| 273 |
-
<?php } ?>
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
});
|
| 291 |
-
</script>
|
| 292 |
-
<?php
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
?>
|
| 297 |
-
<script type="text/javascript">
|
| 298 |
-
jQuery(document).ready(function($) {
|
| 299 |
-
|
| 300 |
-
<?php if(
|
| 301 |
-
|
| 302 |
-
<?php } ?>
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
});
|
| 321 |
-
</script>
|
| 322 |
-
<?php
|
| 323 |
-
|
| 324 |
|
| 325 |
// =========================================== add apply button ==========================================
|
| 326 |
|
| 327 |
-
|
| 328 |
-
?>
|
| 329 |
-
<script type="text/javascript">
|
| 330 |
-
jQuery(document).ready(function() {
|
| 331 |
-
|
| 332 |
-
});
|
| 333 |
|
| 334 |
-
jQuery(document).ready(function($) {
|
| 335 |
|
| 336 |
-
<?php if(
|
| 337 |
-
|
| 338 |
-
<?php } ?>
|
| 339 |
|
| 340 |
-
|
| 341 |
|
| 342 |
-
|
| 343 |
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
|
| 355 |
-
|
| 356 |
|
| 357 |
-
});
|
| 358 |
-
</script>
|
| 359 |
-
<?php
|
| 360 |
-
|
| 361 |
|
| 362 |
// =====================================================
|
| 363 |
-
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
}
|
| 367 |
|
| 368 |
// --------------------------------------------------------
|
|
@@ -371,24 +373,24 @@ jQuery(document).ready(function($) {
|
|
| 371 |
|
| 372 |
function wooccm_billing_override_this() {
|
| 373 |
|
| 374 |
-
|
| 375 |
|
| 376 |
-
|
| 377 |
|
| 378 |
-
|
| 379 |
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
|
| 384 |
-
|
| 385 |
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
<style type="text/css">
|
| 391 |
-
#billing_'
|
| 392 |
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
| 393 |
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
| 394 |
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
|
@@ -402,445 +404,430 @@ function wooccm_billing_override_this() {
|
|
| 402 |
cursor: pointer;
|
| 403 |
position: relative;
|
| 404 |
}
|
| 405 |
-
#billing_'
|
| 406 |
top: 1px;
|
| 407 |
}
|
| 408 |
</style>';
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
<style type="text/css">
|
| 413 |
-
.woocommerce form #customer_details #billing_'
|
| 414 |
-
.woocommerce-page form #customer_details #billing_'
|
| 415 |
-
.woocommerce form.checkout #billing_'
|
| 416 |
display: none;
|
| 417 |
}
|
| 418 |
</style>';
|
| 419 |
-
|
| 420 |
-
|
| 421 |
|
| 422 |
// ====================== CHECKBOX =============================
|
| 423 |
// script when clicked show
|
| 424 |
// =============================================================
|
| 425 |
-
?>
|
| 426 |
-
<!-- Billing section: Checkbox -->
|
| 427 |
-
<script type="text/javascript">
|
| 428 |
-
jQuery(document).ready(function($){
|
| 429 |
-
<?php
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
?>
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
<?php
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
?>
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
<?php if(
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
<?php } ?>
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
<?php
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
?>
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
<?php
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
?>
|
| 479 |
-
});
|
| 480 |
-
</script>
|
| 481 |
-
<?php
|
| 482 |
-
|
| 483 |
// ================================ END!!! =====================================
|
| 484 |
// =============================================================================
|
| 485 |
-
|
| 486 |
// ====================== SELECT OPTIONS =============================
|
| 487 |
// script when clicked show
|
| 488 |
// =============================================================
|
| 489 |
-
?>
|
| 490 |
-
<!-- Billing section: Select options -->
|
| 491 |
-
<script type="text/javascript">
|
| 492 |
-
jQuery(document).ready(function($){
|
| 493 |
-
|
| 494 |
-
<?php
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
?>
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
<?php
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
?>
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
<?php if(
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
<?php } ?>
|
| 531 |
-
|
| 532 |
-
<?php
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
?>
|
| 536 |
-
|
| 537 |
-
<?php
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
?>
|
| 542 |
-
});
|
| 543 |
-
</script>
|
| 544 |
-
|
| 545 |
-
<?php
|
| 546 |
-
|
| 547 |
// ================================ END!!! =====================================
|
| 548 |
// =============================================================================
|
| 549 |
-
|
| 550 |
// ====================== RADIO BUTTON =============================
|
| 551 |
// script when clicked show
|
| 552 |
// =============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
| 553 |
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
jQuery(document).ready(function($){
|
| 558 |
-
|
| 559 |
-
<?php
|
| 560 |
-
foreach( $options['billing_buttons'] as $btn ) {
|
| 561 |
-
if( $btn['type'] == 'wooccmradio' ) {
|
| 562 |
-
|
| 563 |
-
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
| 564 |
-
?>
|
| 565 |
|
| 566 |
-
|
|
|
|
| 567 |
|
| 568 |
-
<?php
|
| 569 |
-
foreach( $options['billing_buttons'] as $btn3 ) {
|
| 570 |
-
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
| 571 |
-
?>
|
| 572 |
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
|
|
|
| 576 |
|
| 577 |
-
|
| 578 |
-
|
|
|
|
| 579 |
|
| 580 |
-
<?php
|
|
|
|
| 581 |
|
| 582 |
-
|
| 583 |
|
| 584 |
-
|
| 585 |
-
data = {
|
| 586 |
-
action: 'remove_tax_wccm',
|
| 587 |
-
empty_check_add: 'none'
|
| 588 |
-
};
|
| 589 |
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
|
|
|
| 594 |
|
| 595 |
-
|
|
|
|
|
|
|
|
|
|
| 596 |
|
| 597 |
-
|
| 598 |
|
| 599 |
-
|
| 600 |
-
}
|
| 601 |
-
}
|
| 602 |
-
?>
|
| 603 |
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
}
|
| 609 |
-
?>
|
| 610 |
-
});
|
| 611 |
-
</script>
|
| 612 |
|
| 613 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 614 |
|
|
|
|
| 615 |
// ================================ END!!! =====================================
|
| 616 |
// =============================================================================
|
| 617 |
-
|
| 618 |
// ----------------------------- CLEAR ---------------------------------
|
| 619 |
// ---------------------------------------------------------------------
|
| 620 |
// ---------------------------------------------------------------------
|
| 621 |
|
| 622 |
-
|
| 623 |
-
|
| 624 |
|
| 625 |
-
|
| 626 |
-
|
| 627 |
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
|
| 633 |
-
|
| 634 |
|
| 635 |
-
|
| 636 |
-
|
|
|
|
|
|
|
| 637 |
|
| 638 |
-
|
| 639 |
-
if( !empty( $btn['single_p'] ) && empty( $btn['more_content'] ) ) {
|
| 640 |
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
if( in_array( $values['product_id'], $multiarrayproductsx ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
| 644 |
-
echo '
|
| 645 |
<style type="text/css">
|
| 646 |
-
.woocommerce form #customer_details #billing_'
|
| 647 |
-
.woocommerce-page form #customer_details #billing_'
|
| 648 |
-
.woocommerce form.checkout #billing_'
|
| 649 |
display: none;
|
| 650 |
}
|
| 651 |
</style>';
|
| 652 |
-
|
| 653 |
-
|
| 654 |
|
| 655 |
-
|
| 656 |
-
|
| 657 |
|
| 658 |
-
|
| 659 |
|
| 660 |
-
|
| 661 |
-
|
| 662 |
<style type="text/css">
|
| 663 |
-
.woocommerce form #customer_details #billing_'
|
| 664 |
-
.woocommerce-page form #customer_details #billing_'
|
| 665 |
-
.woocommerce form.checkout #billing_'
|
| 666 |
display: inline-block;
|
| 667 |
}
|
| 668 |
</style>';
|
| 669 |
-
|
| 670 |
|
| 671 |
-
|
| 672 |
-
|
| 673 |
<style type="text/css">
|
| 674 |
-
.woocommerce form #customer_details #billing_'
|
| 675 |
-
.woocommerce-page form #customer_details #billing_'
|
| 676 |
-
.woocommerce form.checkout #billing_'
|
| 677 |
display: none;
|
| 678 |
}
|
| 679 |
</style>';
|
| 680 |
-
|
| 681 |
-
|
| 682 |
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
|
| 689 |
-
|
| 690 |
|
| 691 |
-
|
| 692 |
|
| 693 |
-
|
| 694 |
|
| 695 |
-
|
| 696 |
|
| 697 |
-
|
| 698 |
-
|
| 699 |
<style type="text/css">
|
| 700 |
-
.woocommerce form #customer_details #billing_'
|
| 701 |
-
.woocommerce-page form #customer_details #billing_'
|
| 702 |
-
.woocommerce form.checkout #billing_'
|
| 703 |
display: none;
|
| 704 |
}
|
| 705 |
</style>';
|
| 706 |
-
|
| 707 |
-
|
| 708 |
|
| 709 |
-
|
| 710 |
-
|
| 711 |
|
| 712 |
-
|
| 713 |
|
| 714 |
-
|
| 715 |
-
|
| 716 |
<style type="text/css">
|
| 717 |
-
.woocommerce form #customer_details #billing_'
|
| 718 |
-
.woocommerce-page form #customer_details #billing_'
|
| 719 |
-
.woocommerce form.checkout #billing_'
|
| 720 |
display: inline-block;
|
| 721 |
}
|
| 722 |
</style>';
|
| 723 |
-
|
| 724 |
|
| 725 |
-
|
| 726 |
-
|
| 727 |
<style type="text/css">
|
| 728 |
-
.woocommerce form #customer_details #billing_'
|
| 729 |
-
.woocommerce-page form #customer_details #billing_'
|
| 730 |
-
.woocommerce form.checkout #billing_'
|
| 731 |
display: none;
|
| 732 |
}
|
| 733 |
</style>';
|
| 734 |
-
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
// end cart
|
| 741 |
-
|
| 742 |
// ===========================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
| 743 |
|
| 744 |
-
|
| 745 |
-
// hide field
|
| 746 |
-
|
| 747 |
-
// with more
|
| 748 |
-
if( !empty( $btn['single_p'] ) && !empty( $btn['more_content'] ) ) {
|
| 749 |
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
if( array_intersect( $productsarraycm, $multiarrayproductsx ) ) {
|
| 753 |
-
echo '
|
| 754 |
<style type="text/css">
|
| 755 |
-
.woocommerce form #customer_details #billing_'
|
| 756 |
-
.woocommerce-page form #customer_details #billing_'
|
| 757 |
-
.woocommerce form.checkout #billing_'
|
| 758 |
display: none;
|
| 759 |
}
|
| 760 |
</style>';
|
| 761 |
-
|
| 762 |
-
|
| 763 |
|
| 764 |
-
|
| 765 |
-
|
| 766 |
|
| 767 |
-
|
| 768 |
|
| 769 |
-
|
| 770 |
-
|
| 771 |
<style type="text/css">
|
| 772 |
-
.woocommerce form #customer_details #billing_'
|
| 773 |
-
.woocommerce-page form #customer_details #billing_'
|
| 774 |
-
.woocommerce form.checkout #billing_'
|
| 775 |
display: inline-block;
|
| 776 |
}
|
| 777 |
</style>';
|
| 778 |
-
|
| 779 |
|
| 780 |
-
|
| 781 |
-
|
| 782 |
<style type="text/css">
|
| 783 |
-
.woocommerce form #customer_details #billing_'
|
| 784 |
-
.woocommerce-page form #customer_details #billing_'
|
| 785 |
-
.woocommerce form.checkout #billing_'
|
| 786 |
display: none;
|
| 787 |
}
|
| 788 |
</style>';
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
// Category
|
| 793 |
-
// hide field
|
| 794 |
|
| 795 |
-
|
| 796 |
-
|
|
|
|
|
|
|
| 797 |
|
| 798 |
-
|
| 799 |
|
| 800 |
-
|
| 801 |
-
|
| 802 |
<style type="text/css">
|
| 803 |
-
.woocommerce form #customer_details #billing_'
|
| 804 |
-
.woocommerce-page form #customer_details #billing_'
|
| 805 |
-
.woocommerce form.checkout #billing_'
|
| 806 |
display: none;
|
| 807 |
}
|
| 808 |
</style>';
|
| 809 |
-
|
| 810 |
-
|
| 811 |
|
| 812 |
-
|
| 813 |
-
|
| 814 |
|
| 815 |
-
|
| 816 |
|
| 817 |
-
|
| 818 |
-
|
| 819 |
<style type="text/css">
|
| 820 |
-
.woocommerce form #customer_details #billing_'
|
| 821 |
-
.woocommerce-page form #customer_details #billing_'
|
| 822 |
-
.woocommerce form.checkout #billing_'
|
| 823 |
display: inline-block;
|
| 824 |
}
|
| 825 |
</style>';
|
| 826 |
-
|
| 827 |
|
| 828 |
-
|
| 829 |
-
|
| 830 |
<style type="text/css">
|
| 831 |
-
.woocommerce form #customer_details #billing_'
|
| 832 |
-
.woocommerce-page form #customer_details #billing_'
|
| 833 |
-
.woocommerce form.checkout #billing_'
|
| 834 |
display: none;
|
| 835 |
}
|
| 836 |
</style>';
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
$categoryarraycm = array();
|
| 841 |
-
$productsarraycm = array();
|
| 842 |
-
|
| 843 |
-
} // btn cut
|
| 844 |
|
|
|
|
|
|
|
|
|
|
| 845 |
}
|
| 846 |
?>
|
| 2 |
/**
|
| 3 |
* WooCommerce Checkout Manager
|
| 4 |
*/
|
|
|
|
| 5 |
// Exit if accessed directly
|
| 6 |
+
if (!defined('ABSPATH'))
|
| 7 |
+
exit;
|
| 8 |
|
| 9 |
function wooccm_billing_hide_required() {
|
| 10 |
|
| 11 |
+
global $woocommerce;
|
| 12 |
|
| 13 |
+
$options = get_option('wccs_settings3');
|
| 14 |
|
| 15 |
+
$billing = array(
|
| 16 |
+
'address_1',
|
| 17 |
+
'address_2',
|
| 18 |
+
'city',
|
| 19 |
+
'state',
|
| 20 |
+
'postcode'
|
| 21 |
+
);
|
| 22 |
|
| 23 |
+
if (!empty($options['billing_buttons'])) {
|
| 24 |
+
echo '
|
| 25 |
<style>
|
| 26 |
';
|
| 27 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 28 |
+
if (in_array($btn['cow'], $billing) && empty($btn['checkbox'])) {
|
| 29 |
+
echo '
|
| 30 |
+
p#billing_' . $btn['cow'] . '_field .required{
|
| 31 |
display:none;
|
| 32 |
}';
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
echo '
|
| 36 |
</style>';
|
| 37 |
+
}
|
|
|
|
| 38 |
}
|
| 39 |
|
| 40 |
function wooccm_billing_scripts() {
|
| 41 |
|
| 42 |
+
global $woocommerce;
|
| 43 |
|
| 44 |
+
$options = get_option('wccs_settings3');
|
| 45 |
|
| 46 |
+
$saved = WC()->session->get('wooccm_retain', array());
|
| 47 |
|
| 48 |
+
// Check if we have any buttons
|
| 49 |
+
if (empty($options['billing_buttons']))
|
| 50 |
+
return;
|
| 51 |
|
| 52 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 53 |
|
| 54 |
+
if ($btn['type'] == 'datepicker') {
|
| 55 |
+
echo '
|
| 56 |
<script type="text/javascript">
|
| 57 |
jQuery(document).ready(function() {
|
| 58 |
var today = new Date();
|
| 59 |
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
| 60 |
+
jQuery("input#billing_' . $btn['cow'] . '").datepicker({
|
| 61 |
';
|
| 62 |
+
// Default date format
|
| 63 |
+
if (empty($btn['format_date']))
|
| 64 |
+
$btn['format_date'] = apply_filters('wooccm_datepicker_default_date_format', 'dd-mm-yy');
|
| 65 |
+
if (!empty($btn['format_date'])) {
|
| 66 |
+
echo 'dateFormat : "' . str_replace(' ', '', $btn['format_date']) . '",';
|
| 67 |
+
}
|
| 68 |
+
if (!empty($btn['single_yy'])) {
|
| 69 |
+
echo 'minDate: new Date( ' . $btn['single_yy'] . ', ' . $btn['single_mm'] . ' - 1, ' . $btn['single_dd'] . '),';
|
| 70 |
+
}
|
| 71 |
+
if (!empty($btn['min_before'])) {
|
| 72 |
+
echo 'minDate: ' . $btn['min_before'] . ',';
|
| 73 |
+
}
|
| 74 |
+
if (!empty($btn['single_max_yy'])) {
|
| 75 |
+
echo 'maxDate: new Date( ' . $btn['single_max_yy'] . ', ' . $btn['single_max_mm'] . ' - 1, ' . $btn['single_max_dd'] . '),';
|
| 76 |
+
}
|
| 77 |
+
if (!empty($btn['max_after'])) {
|
| 78 |
+
echo 'maxDate: ' . $btn['max_after'] . ',';
|
| 79 |
+
}
|
| 80 |
+
if (!empty($btn['days_disabler'])) {
|
| 81 |
+
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
| 82 |
+
if (!empty($btn['days_disabler0'])) {
|
| 83 |
+
echo 'day == 0';
|
| 84 |
+
} else {
|
| 85 |
+
echo 'day == "x"';
|
| 86 |
+
}
|
| 87 |
+
if (!empty($btn['days_disabler1'])) {
|
| 88 |
+
echo ' || day == 1';
|
| 89 |
+
}
|
| 90 |
+
if (!empty($btn['days_disabler2'])) {
|
| 91 |
+
echo ' || day == 2';
|
| 92 |
+
}
|
| 93 |
+
if (!empty($btn['days_disabler3'])) {
|
| 94 |
+
echo ' || day == 3';
|
| 95 |
+
}
|
| 96 |
+
if (!empty($btn['days_disabler4'])) {
|
| 97 |
+
echo ' || day == 4';
|
| 98 |
+
}
|
| 99 |
+
if (!empty($btn['days_disabler5'])) {
|
| 100 |
+
echo ' || day == 5';
|
| 101 |
+
}
|
| 102 |
+
if (!empty($btn['days_disabler6'])) {
|
| 103 |
+
echo '|| day == 6';
|
| 104 |
+
}
|
| 105 |
+
echo ')]; }';
|
| 106 |
+
}
|
| 107 |
+
do_action('wooccm_js_datepicker_billing_args', $btn);
|
| 108 |
+
echo '
|
| 109 |
});
|
| 110 |
}
|
| 111 |
});
|
| 112 |
</script>
|
| 113 |
';
|
| 114 |
+
}
|
| 115 |
|
| 116 |
+
if ($btn['type'] == 'time') {
|
| 117 |
+
$args = '
|
| 118 |
showPeriod: true,';
|
| 119 |
+
if (!empty($btn['start_hour'])) {
|
| 120 |
+
$args .= '
|
| 121 |
+
hours: { starts: ' . $btn['start_hour'] . ', ends: ' . $btn['end_hour'] . ' },';
|
| 122 |
+
}
|
| 123 |
+
if (!empty($btn['interval_min'])) {
|
| 124 |
+
$args .= '
|
| 125 |
+
minutes: {interval: ' . $btn['interval_min'] . ', manual: [' . $btn['manual_min'] . '] },';
|
| 126 |
+
}
|
| 127 |
+
$args .= '
|
| 128 |
showLeadingZero: true';
|
| 129 |
+
$args = apply_filters('wooccm_timepicker_jquery_args', $args, $btn);
|
| 130 |
+
echo '
|
| 131 |
<!-- Billing section: TimePicker -->
|
| 132 |
<script type="text/javascript">
|
| 133 |
jQuery(document).ready(function() {
|
| 134 |
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
| 135 |
+
jQuery("#billing_' . $btn['cow'] . '_field input#billing_' . $btn['cow'] . '").timepicker({
|
| 136 |
';
|
| 137 |
+
echo $args;
|
| 138 |
+
echo '
|
| 139 |
});
|
| 140 |
}
|
| 141 |
});
|
| 142 |
</script>
|
| 143 |
';
|
| 144 |
+
}
|
| 145 |
|
| 146 |
+
if ($btn['type'] == 'password') {
|
| 147 |
+
echo '
|
| 148 |
<script type="text/javascript">
|
| 149 |
jQuery(document).ready(function() {
|
| 150 |
+
jQuery("p#billing_' . $btn['cow'] . '_field").css("display");
|
| 151 |
});
|
| 152 |
</script>
|
| 153 |
';
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
if ($btn['type'] == 'colorpicker') {
|
| 157 |
+
switch ($btn['colorpickertype']) {
|
| 158 |
+
|
| 159 |
+
case 'farbtastic':
|
| 160 |
+
?>
|
| 161 |
+
<script type="text/javascript">
|
| 162 |
+
jQuery(document).ready(function ($) {
|
| 163 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
| 164 |
+
if (jQuery.isFunction(jQuery.fn.farbtastic)) {
|
| 165 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#billing_<?php echo $btn['cow']; ?>_colorpicker");
|
| 166 |
+
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
| 167 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
| 168 |
+
});
|
| 169 |
+
}
|
| 170 |
+
});
|
| 171 |
+
</script>
|
| 172 |
+
<?php
|
| 173 |
+
break;
|
| 174 |
+
|
| 175 |
+
case 'iris':
|
| 176 |
+
?>
|
| 177 |
+
<script type="text/javascript">
|
| 178 |
+
jQuery(document).ready(function ($) {
|
| 179 |
+
|
| 180 |
+
$('#<?php echo $btn['cow']; ?>_colorpicker').css('color', '#fff');
|
| 181 |
+
$('#<?php echo $btn['cow']; ?>_colorpicker').css('background', '<?php echo $btn['colorpickerd']; ?>');
|
| 182 |
+
|
| 183 |
+
var options = {
|
| 184 |
+
wccmclass: "billing_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
| 185 |
+
palettes: true,
|
| 186 |
+
color: "",
|
| 187 |
+
hide: false,
|
| 188 |
+
change: function (event, ui) {
|
| 189 |
+
$('#billing_<?php echo $btn['cow']; ?>_colorpicker').css('color', '#000');
|
| 190 |
+
$('#billing_<?php echo $btn['cow']; ?>_colorpicker').css('background', ui.color.toString());
|
| 191 |
+
}
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').iris(options);
|
| 195 |
+
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
| 196 |
+
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function () {
|
| 197 |
+
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()
|
| 198 |
+
});
|
| 199 |
+
|
| 200 |
+
});
|
| 201 |
+
</script>
|
| 202 |
+
<?php
|
| 203 |
+
break;
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
|
| 207 |
// ============================== radio button & checkbox ===========================================
|
| 208 |
|
| 209 |
+
if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['tax_remove'])) {
|
| 210 |
+
?>
|
| 211 |
+
<script type="text/javascript">
|
| 212 |
+
jQuery(document).ready(function ($) {
|
| 213 |
+
|
| 214 |
+
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
| 215 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
| 216 |
+
<?php } ?>
|
| 217 |
+
|
| 218 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function () {
|
| 219 |
+
|
| 220 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 221 |
+
|
| 222 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 223 |
+
data = {
|
| 224 |
+
action: 'remove_tax_wccm',
|
| 225 |
+
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
| 226 |
+
};
|
| 227 |
+
|
| 228 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 229 |
+
$('body').trigger('update_checkout');
|
| 230 |
+
jQuery('form.checkout').unblock();
|
| 231 |
+
});
|
| 232 |
+
|
| 233 |
+
});
|
| 234 |
+
});
|
| 235 |
+
</script>
|
| 236 |
+
<?php
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
if (( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
| 240 |
+
?>
|
| 241 |
+
<script type="text/javascript">
|
| 242 |
+
jQuery(document).ready(function ($) {
|
| 243 |
+
|
| 244 |
+
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
| 245 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
| 246 |
+
<?php } ?>
|
| 247 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function () {
|
| 248 |
+
|
| 249 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 250 |
+
|
| 251 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 252 |
+
data = {
|
| 253 |
+
action: 'remove_tax_wccm',
|
| 254 |
+
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
| 255 |
+
};
|
| 256 |
+
|
| 257 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 258 |
+
$('body').trigger('update_checkout');
|
| 259 |
+
jQuery('form.checkout').unblock();
|
| 260 |
+
});
|
| 261 |
+
|
| 262 |
+
});
|
| 263 |
+
});
|
| 264 |
+
</script>
|
| 265 |
+
<?php
|
| 266 |
+
}
|
| 267 |
|
| 268 |
// =========================================== select options =========================================
|
| 269 |
|
| 270 |
+
if ($btn['type'] == 'wooccmselect' && !empty($btn['tax_remove'])) {
|
| 271 |
+
?>
|
| 272 |
+
<script type="text/javascript">
|
| 273 |
+
jQuery(document).ready(function ($) {
|
| 274 |
+
|
| 275 |
+
<?php if (!empty($saved['wooccm_tax_save_method'])) { ?>
|
| 276 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_tax_save_method']; ?>');
|
| 277 |
+
<?php } ?>
|
| 278 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function () {
|
| 279 |
+
|
| 280 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 281 |
+
|
| 282 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 283 |
+
data = {
|
| 284 |
+
action: 'remove_tax_wccm',
|
| 285 |
+
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
| 286 |
+
};
|
| 287 |
+
|
| 288 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 289 |
+
$('body').trigger('update_checkout');
|
| 290 |
+
jQuery('form.checkout').unblock();
|
| 291 |
+
});
|
| 292 |
+
|
| 293 |
+
});
|
| 294 |
+
});
|
| 295 |
+
</script>
|
| 296 |
+
<?php
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
if ($btn['type'] == 'wooccmselect' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && !empty($btn['add_amount_field'])) {
|
| 300 |
+
?>
|
| 301 |
+
<script type="text/javascript">
|
| 302 |
+
jQuery(document).ready(function ($) {
|
| 303 |
+
|
| 304 |
+
<?php if (!empty($saved['wooccm_addamount453user'])) { ?>
|
| 305 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val('<?php echo $saved['wooccm_addamount453user']; ?>');
|
| 306 |
+
<?php } ?>
|
| 307 |
+
|
| 308 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function () {
|
| 309 |
+
|
| 310 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 311 |
+
|
| 312 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 313 |
+
data = {
|
| 314 |
+
action: 'remove_tax_wccm',
|
| 315 |
+
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
| 316 |
+
};
|
| 317 |
+
|
| 318 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 319 |
+
$('body').trigger('update_checkout');
|
| 320 |
+
jQuery('form.checkout').unblock();
|
| 321 |
+
});
|
| 322 |
+
|
| 323 |
+
});
|
| 324 |
+
});
|
| 325 |
+
</script>
|
| 326 |
+
<?php
|
| 327 |
+
}
|
| 328 |
|
| 329 |
// =========================================== add apply button ==========================================
|
| 330 |
|
| 331 |
+
if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
|
| 332 |
+
?>
|
| 333 |
+
<script type="text/javascript">
|
| 334 |
+
jQuery(document).ready(function () {
|
| 335 |
+
jQuery("#billing_<?php echo $btn['cow']; ?>_field").append('<span id="billing_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply', 'woocommerce-checkout-manager'); ?></span>');
|
| 336 |
+
});
|
| 337 |
|
| 338 |
+
jQuery(document).ready(function ($) {
|
| 339 |
|
| 340 |
+
<?php if (!empty($saved['wooccm_addamount453userf'])) { ?>
|
| 341 |
+
jQuery('input#billing_<?php echo $btn['cow']; ?>').val('<?php echo $saved['wooccm_addamount453userf']; ?>');
|
| 342 |
+
<?php } ?>
|
| 343 |
|
| 344 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field #billing_<?php echo $btn['cow']; ?>_applynow').click(function () {
|
| 345 |
|
| 346 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 347 |
|
| 348 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 349 |
+
data = {
|
| 350 |
+
action: 'remove_tax_wccm',
|
| 351 |
+
add_amount_faj: jQuery('input#billing_<?php echo $btn['cow']; ?>').val()
|
| 352 |
+
};
|
| 353 |
|
| 354 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 355 |
+
$('body').trigger('update_checkout');
|
| 356 |
+
jQuery('form.checkout').unblock();
|
| 357 |
+
});
|
| 358 |
|
| 359 |
+
});
|
| 360 |
|
| 361 |
+
});
|
| 362 |
+
</script>
|
| 363 |
+
<?php
|
| 364 |
+
}
|
| 365 |
|
| 366 |
// =====================================================
|
| 367 |
+
}
|
|
|
|
|
|
|
| 368 |
}
|
| 369 |
|
| 370 |
// --------------------------------------------------------
|
| 373 |
|
| 374 |
function wooccm_billing_override_this() {
|
| 375 |
|
| 376 |
+
global $woocommerce;
|
| 377 |
|
| 378 |
+
$options = get_option('wccs_settings3');
|
| 379 |
|
| 380 |
+
$options['billing_buttons'] = ( isset($options['billing_buttons']) ? $options['billing_buttons'] : array() );
|
| 381 |
|
| 382 |
+
// Check if there are any buttons
|
| 383 |
+
if (count($options['billing_buttons']) == 0)
|
| 384 |
+
return;
|
| 385 |
|
| 386 |
+
$i = 0;
|
| 387 |
|
| 388 |
+
// css sub-parent hide
|
| 389 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 390 |
+
if ($btn['type'] == 'text' && !empty($btn['add_amount']) && !empty($btn['fee_name']) && empty($btn['add_amount_field'])) {
|
| 391 |
+
echo '
|
| 392 |
<style type="text/css">
|
| 393 |
+
#billing_' . $btn['cow'] . '_applynow {
|
| 394 |
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
| 395 |
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
| 396 |
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
| 404 |
cursor: pointer;
|
| 405 |
position: relative;
|
| 406 |
}
|
| 407 |
+
#billing_' . $btn['cow'] . '_applynow:active {
|
| 408 |
top: 1px;
|
| 409 |
}
|
| 410 |
</style>';
|
| 411 |
+
}
|
| 412 |
+
if (!empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) {
|
| 413 |
+
echo '
|
| 414 |
<style type="text/css">
|
| 415 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ',
|
| 416 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ',
|
| 417 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' {
|
| 418 |
display: none;
|
| 419 |
}
|
| 420 |
</style>';
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
|
| 424 |
// ====================== CHECKBOX =============================
|
| 425 |
// script when clicked show
|
| 426 |
// =============================================================
|
| 427 |
+
?>
|
| 428 |
+
<!-- Billing section: Checkbox -->
|
| 429 |
+
<script type="text/javascript">
|
| 430 |
+
jQuery(document).ready(function ($) {
|
| 431 |
+
<?php
|
| 432 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 433 |
+
if ($btn['type'] == 'checkbox_wccm') {
|
| 434 |
+
|
| 435 |
+
if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
|
| 436 |
+
?>
|
| 437 |
+
|
| 438 |
+
jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]").click(function () {
|
| 439 |
+
|
| 440 |
+
<?php
|
| 441 |
+
foreach ($options['billing_buttons'] as $btn3) {
|
| 442 |
+
if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
|
| 443 |
+
?>
|
| 444 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>') {
|
| 445 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
|
| 446 |
+
}
|
| 447 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>') {
|
| 448 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
|
| 449 |
+
|
| 450 |
+
<?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
|
| 451 |
+
|
| 452 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 453 |
+
|
| 454 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 455 |
+
data = {
|
| 456 |
+
action: 'remove_tax_wccm',
|
| 457 |
+
empty_check_add: 'none'
|
| 458 |
+
};
|
| 459 |
+
|
| 460 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 461 |
+
$('body').trigger('update_checkout');
|
| 462 |
+
jQuery('form.checkout').unblock();
|
| 463 |
+
});
|
| 464 |
+
|
| 465 |
+
<?php } ?>
|
| 466 |
+
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
<?php
|
| 470 |
+
}
|
| 471 |
+
}
|
| 472 |
+
?>
|
| 473 |
+
|
| 474 |
+
});
|
| 475 |
+
|
| 476 |
+
<?php
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
?>
|
| 481 |
+
});
|
| 482 |
+
</script>
|
| 483 |
+
<?php
|
|
|
|
| 484 |
// ================================ END!!! =====================================
|
| 485 |
// =============================================================================
|
|
|
|
| 486 |
// ====================== SELECT OPTIONS =============================
|
| 487 |
// script when clicked show
|
| 488 |
// =============================================================
|
| 489 |
+
?>
|
| 490 |
+
<!-- Billing section: Select options -->
|
| 491 |
+
<script type="text/javascript">
|
| 492 |
+
jQuery(document).ready(function ($) {
|
| 493 |
+
|
| 494 |
+
<?php
|
| 495 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 496 |
+
if ($btn['type'] == 'wooccmselect') {
|
| 497 |
+
|
| 498 |
+
if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
|
| 499 |
+
?>
|
| 500 |
+
|
| 501 |
+
jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function () {
|
| 502 |
+
|
| 503 |
+
<?php
|
| 504 |
+
foreach ($options['billing_buttons'] as $btn3) {
|
| 505 |
+
if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
|
| 506 |
+
?>
|
| 507 |
+
|
| 508 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>') {
|
| 509 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>') {
|
| 513 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
|
| 514 |
+
|
| 515 |
+
<?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
|
| 516 |
+
|
| 517 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
| 518 |
+
|
| 519 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 520 |
+
data = {
|
| 521 |
+
action: 'remove_tax_wccm',
|
| 522 |
+
empty_check_add: 'none'
|
| 523 |
+
};
|
| 524 |
+
|
| 525 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 526 |
+
$('body').trigger('update_checkout');
|
| 527 |
+
jQuery('form.checkout').unblock();
|
| 528 |
+
});
|
| 529 |
+
|
| 530 |
+
<?php } ?>
|
| 531 |
+
}
|
| 532 |
+
<?php
|
| 533 |
+
}
|
| 534 |
+
}
|
| 535 |
+
?>
|
| 536 |
+
});
|
| 537 |
+
<?php
|
| 538 |
+
}
|
| 539 |
+
}
|
| 540 |
+
}
|
| 541 |
+
?>
|
| 542 |
+
});
|
| 543 |
+
</script>
|
| 544 |
+
|
| 545 |
+
<?php
|
|
|
|
| 546 |
// ================================ END!!! =====================================
|
| 547 |
// =============================================================================
|
|
|
|
| 548 |
// ====================== RADIO BUTTON =============================
|
| 549 |
// script when clicked show
|
| 550 |
// =============================================================
|
| 551 |
+
?>
|
| 552 |
+
<!-- Billing section: Radio buttons -->
|
| 553 |
+
<script type="text/javascript">
|
| 554 |
+
jQuery(document).ready(function ($) {
|
| 555 |
|
| 556 |
+
<?php
|
| 557 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 558 |
+
if ($btn['type'] == 'wooccmradio') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 559 |
|
| 560 |
+
if (!empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) {
|
| 561 |
+
?>
|
| 562 |
|
| 563 |
+
jQuery("#billing_<?php echo '' . $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function () {
|
|
|
|
|
|
|
|
|
|
| 564 |
|
| 565 |
+
<?php
|
| 566 |
+
foreach ($options['billing_buttons'] as $btn3) {
|
| 567 |
+
if (empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) {
|
| 568 |
+
?>
|
| 569 |
|
| 570 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>') {
|
| 571 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show("slow");
|
| 572 |
+
}
|
| 573 |
|
| 574 |
+
if (jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>') {
|
| 575 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide("slow");
|
| 576 |
|
| 577 |
+
<?php if (!empty($btn2['fee_name']) && !empty($btn2['add_amount'])) { ?>
|
| 578 |
|
| 579 |
+
$('form.checkout').block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_get_script_data.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
|
| 581 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
| 582 |
+
data = {
|
| 583 |
+
action: 'remove_tax_wccm',
|
| 584 |
+
empty_check_add: 'none'
|
| 585 |
+
};
|
| 586 |
|
| 587 |
+
jQuery.post(ajaxurl, data, function (response) {
|
| 588 |
+
$('body').trigger('update_checkout');
|
| 589 |
+
jQuery('form.checkout').unblock();
|
| 590 |
+
});
|
| 591 |
|
| 592 |
+
<?php } ?>
|
| 593 |
|
| 594 |
+
}
|
|
|
|
|
|
|
|
|
|
| 595 |
|
| 596 |
+
<?php
|
| 597 |
+
}
|
| 598 |
+
}
|
| 599 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 600 |
|
| 601 |
+
});
|
| 602 |
+
<?php
|
| 603 |
+
}
|
| 604 |
+
}
|
| 605 |
+
}
|
| 606 |
+
?>
|
| 607 |
+
});
|
| 608 |
+
</script>
|
| 609 |
|
| 610 |
+
<?php
|
| 611 |
// ================================ END!!! =====================================
|
| 612 |
// =============================================================================
|
|
|
|
| 613 |
// ----------------------------- CLEAR ---------------------------------
|
| 614 |
// ---------------------------------------------------------------------
|
| 615 |
// ---------------------------------------------------------------------
|
| 616 |
|
| 617 |
+
$categoryarraycm = array();
|
| 618 |
+
$productsarraycm = array();
|
| 619 |
|
| 620 |
+
foreach ($options['billing_buttons'] as $btn) {
|
| 621 |
+
foreach ($woocommerce->cart->cart_contents as $key => $values) {
|
| 622 |
|
| 623 |
+
$multiproductsx = ( isset($btn['single_p']) ? $btn['single_p'] : '' );
|
| 624 |
+
$show_field_single = ( isset($btn['single_px']) ? $btn['single_px'] : '' );
|
| 625 |
+
$multiproductsx_cat = ( isset($btn['single_p_cat']) ? $btn['single_p_cat'] : '' );
|
| 626 |
+
$show_field_single_cat = ( isset($btn['single_px_cat']) ? $btn['single_px_cat'] : '' );
|
| 627 |
|
| 628 |
+
$productsarraycm[] = $values['product_id'];
|
| 629 |
|
| 630 |
+
// Products
|
| 631 |
+
// hide field
|
| 632 |
+
// without more
|
| 633 |
+
if (!empty($btn['single_p']) && empty($btn['more_content'])) {
|
| 634 |
|
| 635 |
+
$multiarrayproductsx = explode(',', $multiproductsx);
|
|
|
|
| 636 |
|
| 637 |
+
if (in_array($values['product_id'], $multiarrayproductsx) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 638 |
+
echo '
|
|
|
|
|
|
|
| 639 |
<style type="text/css">
|
| 640 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 641 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 642 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 643 |
display: none;
|
| 644 |
}
|
| 645 |
</style>';
|
| 646 |
+
}
|
| 647 |
+
}
|
| 648 |
|
| 649 |
+
// show field without more
|
| 650 |
+
if (!empty($btn['single_px']) && empty($btn['more_content'])) {
|
| 651 |
|
| 652 |
+
$show_field_array = explode('||', $show_field_single);
|
| 653 |
|
| 654 |
+
if (in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 655 |
+
echo '
|
| 656 |
<style type="text/css">
|
| 657 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 658 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 659 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 660 |
display: inline-block;
|
| 661 |
}
|
| 662 |
</style>';
|
| 663 |
+
}
|
| 664 |
|
| 665 |
+
if (!in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 666 |
+
echo '
|
| 667 |
<style type="text/css">
|
| 668 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 669 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 670 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 671 |
display: none;
|
| 672 |
}
|
| 673 |
</style>';
|
| 674 |
+
}
|
| 675 |
+
}
|
| 676 |
|
| 677 |
+
// Category
|
| 678 |
+
// hide field
|
| 679 |
+
/*$terms = get_the_terms($values['product_id'], 'product_cat');
|
| 680 |
+
if (!empty($terms)) {
|
| 681 |
+
foreach ($terms as $term) {
|
| 682 |
|
| 683 |
+
$categoryarraycm[] = $term->slug;
|
| 684 |
|
| 685 |
+
// without more
|
| 686 |
|
| 687 |
+
if (!empty($btn['single_p_cat']) && empty($btn['more_content'])) {
|
| 688 |
|
| 689 |
+
$multiarrayproductsx_cat = explode(',', $multiproductsx_cat);
|
| 690 |
|
| 691 |
+
if (in_array($term->slug, $multiarrayproductsx_cat) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 692 |
+
echo '
|
| 693 |
<style type="text/css">
|
| 694 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 695 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 696 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 697 |
display: none;
|
| 698 |
}
|
| 699 |
</style>';
|
| 700 |
+
}
|
| 701 |
+
}
|
| 702 |
|
| 703 |
+
// show field without more
|
| 704 |
+
/*if (!empty($btn['single_px_cat']) && empty($btn['more_content'])) {
|
| 705 |
|
| 706 |
+
$show_field_array_cat = explode('||', $show_field_single_cat);
|
| 707 |
|
| 708 |
+
if (in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 709 |
+
echo '
|
| 710 |
<style type="text/css">
|
| 711 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 712 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 713 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 714 |
display: inline-block;
|
| 715 |
}
|
| 716 |
</style>';
|
| 717 |
+
}
|
| 718 |
|
| 719 |
+
if (!in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2 )) {
|
| 720 |
+
echo '
|
| 721 |
<style type="text/css">
|
| 722 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 723 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 724 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 725 |
display: none;
|
| 726 |
}
|
| 727 |
</style>';
|
| 728 |
+
}
|
| 729 |
+
}
|
| 730 |
+
}
|
| 731 |
+
}*/
|
| 732 |
+
}
|
| 733 |
+
// end cart
|
|
|
|
|
|
|
| 734 |
// ===========================================================================================
|
| 735 |
+
// Products
|
| 736 |
+
// hide field
|
| 737 |
+
// with more
|
| 738 |
+
if (!empty($btn['single_p']) && !empty($btn['more_content'])) {
|
| 739 |
|
| 740 |
+
$multiarrayproductsx = explode(',', $multiproductsx);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
|
| 742 |
+
if (array_intersect($productsarraycm, $multiarrayproductsx)) {
|
| 743 |
+
echo '
|
|
|
|
|
|
|
| 744 |
<style type="text/css">
|
| 745 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 746 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 747 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 748 |
display: none;
|
| 749 |
}
|
| 750 |
</style>';
|
| 751 |
+
}
|
| 752 |
+
}
|
| 753 |
|
| 754 |
+
// show field with more
|
| 755 |
+
if (!empty($btn['single_px']) && !empty($btn['more_content'])) {
|
| 756 |
|
| 757 |
+
$show_field_array = explode('||', $show_field_single);
|
| 758 |
|
| 759 |
+
if (array_intersect($productsarraycm, $show_field_array)) {
|
| 760 |
+
echo '
|
| 761 |
<style type="text/css">
|
| 762 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 763 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 764 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 765 |
display: inline-block;
|
| 766 |
}
|
| 767 |
</style>';
|
| 768 |
+
}
|
| 769 |
|
| 770 |
+
if (!array_intersect($productsarraycm, $show_field_array)) {
|
| 771 |
+
echo '
|
| 772 |
<style type="text/css">
|
| 773 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 774 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 775 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 776 |
display: none;
|
| 777 |
}
|
| 778 |
</style>';
|
| 779 |
+
}
|
| 780 |
+
}
|
|
|
|
|
|
|
|
|
|
| 781 |
|
| 782 |
+
// Category
|
| 783 |
+
// hide field
|
| 784 |
+
// with more
|
| 785 |
+
/*if (!empty($btn['single_p_cat']) && !empty($btn['more_content'])) {
|
| 786 |
|
| 787 |
+
$multiarrayproductsx_cat = explode(',', $multiproductsx_cat);
|
| 788 |
|
| 789 |
+
if (array_intersect($categoryarraycm, $multiarrayproductsx_cat)) {
|
| 790 |
+
echo '
|
| 791 |
<style type="text/css">
|
| 792 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 793 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 794 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 795 |
display: none;
|
| 796 |
}
|
| 797 |
</style>';
|
| 798 |
+
}
|
| 799 |
+
}
|
| 800 |
|
| 801 |
+
// show field with more
|
| 802 |
+
if (!empty($btn['single_px_cat']) && !empty($btn['more_content'])) {
|
| 803 |
|
| 804 |
+
$show_field_array_cat = explode('||', $show_field_single_cat);
|
| 805 |
|
| 806 |
+
if (array_intersect($categoryarraycm, $show_field_array_cat)) {
|
| 807 |
+
echo '
|
| 808 |
<style type="text/css">
|
| 809 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 810 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 811 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 812 |
display: inline-block;
|
| 813 |
}
|
| 814 |
</style>';
|
| 815 |
+
}
|
| 816 |
|
| 817 |
+
if (!array_intersect($categoryarraycm, $show_field_array_cat)) {
|
| 818 |
+
echo '
|
| 819 |
<style type="text/css">
|
| 820 |
+
.woocommerce form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 821 |
+
.woocommerce-page form #customer_details #billing_' . $btn['cow'] . '_field,
|
| 822 |
+
.woocommerce form.checkout #billing_' . $btn['cow'] . '_field {
|
| 823 |
display: none;
|
| 824 |
}
|
| 825 |
</style>';
|
| 826 |
+
}
|
| 827 |
+
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 828 |
|
| 829 |
+
$categoryarraycm = array();
|
| 830 |
+
$productsarraycm = array();
|
| 831 |
+
} // btn cut
|
| 832 |
}
|
| 833 |
?>
|
new/fields_handler.php
CHANGED
|
@@ -7,31 +7,86 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
| 7 |
protected static $instance;
|
| 8 |
protected static $i = 0;
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
| 25 |
-
return;
|
| 26 |
-
}
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
return $field;
|
| 34 |
-
|
| 35 |
|
| 36 |
function remove_checkout_fields($fields) {
|
| 37 |
|
|
@@ -45,6 +100,7 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
| 45 |
|
| 46 |
foreach ($type as $id => $field) {
|
| 47 |
|
|
|
|
| 48 |
// Remove disabled
|
| 49 |
// -------------------------------------------------------------------
|
| 50 |
if (!empty($field['disabled'])) {
|
|
@@ -112,6 +168,9 @@ if (!class_exists('WOOCCM_Fields_Handler')) {
|
|
| 112 |
|
| 113 |
function init() {
|
| 114 |
|
|
|
|
|
|
|
|
|
|
| 115 |
// Remove fields
|
| 116 |
// -----------------------------------------------------------------------
|
| 117 |
add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
|
| 7 |
protected static $instance;
|
| 8 |
protected static $i = 0;
|
| 9 |
|
| 10 |
+
function remove_by_category($field, $key) {
|
| 11 |
|
| 12 |
+
if (empty($field['disabled'])) {
|
| 13 |
|
| 14 |
+
if (count($cart_contents = WC()->cart->get_cart_contents())) {
|
| 15 |
|
| 16 |
+
$categoryarraycm = array();
|
| 17 |
|
| 18 |
+
$multiproductsx_cat = ( isset($field['single_p_cat']) ? $field['single_p_cat'] : '' );
|
| 19 |
+
$show_field_single_cat = ( isset($field['single_px_cat']) ? $field['single_px_cat'] : '' );
|
| 20 |
|
| 21 |
+
$show_field_array_cat = explode('||', $show_field_single_cat);
|
| 22 |
|
| 23 |
+
$multiarrayproductsx_cat = explode(',', $multiproductsx_cat);
|
| 24 |
|
| 25 |
+
foreach ($cart_contents as $key => $values) {
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
// hide field
|
| 28 |
+
// -----------------------------------------------------------------
|
| 29 |
+
if (!empty($terms = get_the_terms($values['product_id'], 'product_cat'))) {
|
| 30 |
+
|
| 31 |
+
foreach ($terms as $term) {
|
| 32 |
+
|
| 33 |
+
$categoryarraycm[] = $term->slug;
|
| 34 |
+
|
| 35 |
+
// hide field without more
|
| 36 |
+
// -------------------------------------------------------------
|
| 37 |
+
if (!empty($field['single_p_cat']) && empty($field['more_content'])) {
|
| 38 |
+
|
| 39 |
+
if (in_array($term->slug, $multiarrayproductsx_cat) && ( count($cart_contents) < 2 )) {
|
| 40 |
+
$field['disabled'] = true;
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// show field without more
|
| 45 |
+
// -------------------------------------------------------------
|
| 46 |
+
if (!empty($field['single_px_cat']) && empty($field['more_content'])) {
|
| 47 |
+
|
| 48 |
+
if (in_array($term->slug, $show_field_array_cat) && ( count($cart_contents) < 2 )) {
|
| 49 |
+
$field['disabled'] = false;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
if (!in_array($term->slug, $show_field_array_cat) && ( count($cart_contents) < 2 )) {
|
| 53 |
+
$field['disabled'] = true;
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// hide field with more
|
| 59 |
+
// ---------------------------------------------------------------
|
| 60 |
+
if (!empty($btn['single_p_cat']) && !empty($btn['more_content'])) {
|
| 61 |
+
|
| 62 |
+
//$multiarrayproductsx_cat = explode(',', $multiproductsx_cat);
|
| 63 |
+
|
| 64 |
+
if (array_intersect($categoryarraycm, $multiarrayproductsx_cat)) {
|
| 65 |
+
$field['disabled'] = true;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// show field with more
|
| 70 |
+
// ---------------------------------------------------------------
|
| 71 |
+
if (!empty($btn['single_px_cat']) && !empty($btn['more_content'])) {
|
| 72 |
+
|
| 73 |
+
//$show_field_array_cat = explode('||', $show_field_single_cat);
|
| 74 |
+
|
| 75 |
+
if (array_intersect($categoryarraycm, $show_field_array_cat)) {
|
| 76 |
+
$field['disabled'] = false;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
if (!array_intersect($categoryarraycm, $show_field_array_cat)) {
|
| 80 |
+
$field['disabled'] = true;
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
}
|
| 87 |
|
| 88 |
return $field;
|
| 89 |
+
}
|
| 90 |
|
| 91 |
function remove_checkout_fields($fields) {
|
| 92 |
|
| 100 |
|
| 101 |
foreach ($type as $id => $field) {
|
| 102 |
|
| 103 |
+
//var_dump($field);
|
| 104 |
// Remove disabled
|
| 105 |
// -------------------------------------------------------------------
|
| 106 |
if (!empty($field['disabled'])) {
|
| 168 |
|
| 169 |
function init() {
|
| 170 |
|
| 171 |
+
// Remove by category
|
| 172 |
+
add_filter('wooccm_checkout_field_filter', array($this, 'remove_by_category'), 10, 2);
|
| 173 |
+
|
| 174 |
// Remove fields
|
| 175 |
// -----------------------------------------------------------------------
|
| 176 |
add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
|
new/fields_register.php
CHANGED
|
@@ -32,6 +32,8 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
| 32 |
'country'
|
| 33 |
);
|
| 34 |
|
|
|
|
|
|
|
| 35 |
$fields[$key] = wp_parse_args($custom_field, (array) @$fields[$key]);
|
| 36 |
|
| 37 |
// Priority
|
|
@@ -161,7 +163,7 @@ if (!class_exists('WOOCCM_Fields_Register')) {
|
|
| 161 |
|
| 162 |
//error_log(json_encode($fields[$key]));
|
| 163 |
|
| 164 |
-
return $fields[$key];
|
| 165 |
}
|
| 166 |
|
| 167 |
function add_checkout_fields_filter($fields, $name, $key, $prefix = '') {
|
| 32 |
'country'
|
| 33 |
);
|
| 34 |
|
| 35 |
+
//var_dump($fields[$key]);
|
| 36 |
+
|
| 37 |
$fields[$key] = wp_parse_args($custom_field, (array) @$fields[$key]);
|
| 38 |
|
| 39 |
// Priority
|
| 163 |
|
| 164 |
//error_log(json_encode($fields[$key]));
|
| 165 |
|
| 166 |
+
return apply_filters('wooccm_checkout_field_filter', $fields[$key], $key);
|
| 167 |
}
|
| 168 |
|
| 169 |
function add_checkout_fields_filter($fields, $name, $key, $prefix = '') {
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
|
|
| 4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
| 5 |
Requires at least: 3.0
|
| 6 |
Tested up to: 5.2.3
|
| 7 |
-
Stable tag: 4.4.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -137,6 +137,9 @@ Example:
|
|
| 137 |
|
| 138 |
== Changelog ==
|
| 139 |
|
|
|
|
|
|
|
|
|
|
| 140 |
= 4.4.1 =
|
| 141 |
* Fix: Undefined variable: custom_fields
|
| 142 |
* Fix: woocommerce checkout country required when is removed
|
| 4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
| 5 |
Requires at least: 3.0
|
| 6 |
Tested up to: 5.2.3
|
| 7 |
+
Stable tag: 4.4.2
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 137 |
|
| 138 |
== Changelog ==
|
| 139 |
|
| 140 |
+
= 4.4.2 =
|
| 141 |
+
* Fix: woocommerce checkout remove field based on categories
|
| 142 |
+
|
| 143 |
= 4.4.1 =
|
| 144 |
* Fix: Undefined variable: custom_fields
|
| 145 |
* Fix: woocommerce checkout country required when is removed
|
woocommerce-checkout-manager.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
/**
|
| 3 |
* Plugin Name: WooCommerce Checkout Manager
|
| 4 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
| 5 |
-
* Version: 4.4.
|
| 6 |
* Author: QuadLayers
|
| 7 |
* Author URI: https://www.quadlayers.com
|
| 8 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
|
@@ -16,7 +16,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
|
|
| 16 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
| 17 |
}
|
| 18 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
| 19 |
-
define('WOOCCM_PLUGIN_VERSION', '4.4.
|
| 20 |
}
|
| 21 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
| 22 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
| 2 |
/**
|
| 3 |
* Plugin Name: WooCommerce Checkout Manager
|
| 4 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
| 5 |
+
* Version: 4.4.2
|
| 6 |
* Author: QuadLayers
|
| 7 |
* Author URI: https://www.quadlayers.com
|
| 8 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
| 16 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
| 17 |
}
|
| 18 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
| 19 |
+
define('WOOCCM_PLUGIN_VERSION', '4.4.2');
|
| 20 |
}
|
| 21 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
| 22 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
