wcpgsk_product_single_cart_button_text

The Woocommerce Poor Guys Swiss Knife wcpgsk product single cart button text function.

Description

wcpgsk_product_single_cart_button_text( $label, $product ); 

Parameters (2)

0. $label
The label.
1. $product
The product.

Usage

  1. if ( !function_exists( 'wcpgsk_product_single_cart_button_text' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-poor-guys-swiss-knife/wcpgsk-af.php'; 
  3.  
  4. // The label. 
  5. $label = null; 
  6.  
  7. // The product. 
  8. $product = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wcpgsk_product_single_cart_button_text($label, $product); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wcpgsk-af.php  
  1. function wcpgsk_product_single_cart_button_text($label, $product) { 
  2. $options = get_option( 'wcpgsk_settings' ); 
  3. $cart_btn_text = $label; 
  4. if ( $label == __( 'Read more', 'woocommerce' ) ) : 
  5. $cart_btn_text = ((!empty($options['process']['readmorebtn'])) ? __($options['process']['readmorebtn'], WCPGSK_DOMAIN) : $label); 
  6. elseif ($label == __( 'Add to cart', 'woocommerce' ) ) : 
  7. $cart_btn_text = ((!empty($options['process']['fastcheckoutbtn'])) ? __($options['process']['fastcheckoutbtn'], WCPGSK_DOMAIN) : $label); 
  8. if ( isset( $product->post->ID ) && ( is_shop() || is_product() ) ) : 
  9. $button_label = get_post_meta($product->post->ID, '_wcpgsk_button_label', true); 
  10. if ( isset( $button_label ) && !empty( $button_label ) ) : 
  11. $cart_btn_text = __( $button_label, WCPGSK_DOMAIN ); 
  12. endif; 
  13. endif;  
  14. elseif ($label == __( 'Buy product', 'woocommerce' ) ) : 
  15. $cart_btn_text = ((!empty($options['process']['buyproductbtn'])) ? __($options['process']['buyproductbtn'], WCPGSK_DOMAIN) : $label); 
  16. elseif ($label == __( 'View products', 'woocommerce' ) ) : 
  17. $cart_btn_text = ((!empty($options['process']['viewproductsbtn'])) ? __($options['process']['viewproductsbtn'], WCPGSK_DOMAIN) : $label); 
  18. elseif ($label == __( 'Select options', 'woocommerce' ) ) : 
  19. $cart_btn_text = ((!empty($options['process']['selectoptionsbtn'])) ? __($options['process']['selectoptionsbtn'], WCPGSK_DOMAIN) : $label); 
  20. endif; 
  21.  
  22. return $cart_btn_text;