Guest User

bundled-item-optional.php

a guest
Oct 9th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. <?php
  2. /**
  3. * Optional Bundled Item Checkbox template
  4. *
  5. * Override this template by copying it to 'yourtheme/woocommerce/single-product/bundled-item-optional.php'.
  6. *
  7. * On occasion, this template file may need to be updated and you (the theme developer) will need to copy the new files to your theme to maintain compatibility.
  8. * We try to do this as little as possible, but it does happen.
  9. * When this occurs the version of the template file will be bumped and the readme will list any important changes.
  10. *
  11. * @version 6.3.3
  12. */
  13.  
  14. // Exit if accessed directly.
  15. if ( ! defined( 'ABSPATH' ) ) {
  16. exit;
  17. }
  18.  
  19. ?><label class="bundled_product_optional_checkbox">
  20. <input class="bundled_product_checkbox" type="checkbox" name="<?php echo $bundle_fields_prefix; ?>bundle_selected_optional_<?php echo $bundled_item->get_id(); ?>" value="" <?php checked( $bundled_item->is_optional_checked() && $bundled_item->is_in_stock(), true ); echo $bundled_item->is_in_stock() ? '' : 'disabled="disabled"' ; ?> /> <?php
  21.  
  22. $price_html = $bundled_item->product->get_price_html();
  23. if (class_exists('WOOCS')) {
  24. global $WOOCS;
  25. $_price = $bundled_item->product->get_price();
  26. if ($WOOCS->current_currency != $WOOCS->default_currency) {
  27. $currencies = $WOOCS->get_currencies();
  28. if ($WOOCS->is_multiple_allowed) {
  29. $price_html = $WOOCS->wc_price($_price / $currencies[$WOOCS->current_currency]['rate'], false);
  30. }
  31. }
  32. }
  33. $label_price = $bundled_item->is_priced_individually() && $price_html ? sprintf( __( ' for %s', 'woocommerce-product-bundles' ), '<span class="price">' . $price_html . '</span>' ) : '';
  34. $label_title = $bundled_item->get_title() === '' ? sprintf( __( ' &quot;%s&quot;', 'woocommerce-product-bundles' ), WC_PB_Helpers::format_product_shop_title( $bundled_item->get_raw_title(), ( $quantity > 1 && $bundled_item->get_quantity( 'max' ) === $quantity ) ? $quantity : '' ) ) : '';
  35.  
  36. echo sprintf( __( 'Add%1$s%2$s%3$s', 'woocommerce-product-bundles' ), $label_title, $label_price, '' );
  37.  
  38. ?></label><?php
  39.  
  40. if ( $availability_html ) {
  41. echo $availability_html;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment