contendia
Forum Replies Created
-
Never mind. I spoke too soon. There is a typo in the word ‘crowdfunding’, but it does not appear to be affecting the button text. Turns out there is a function on line 84 that specifically overrides the button text if the project is set to open pricing. Not sure the reasoning behind it. Could be because open pricing items cannot be added directly to the cart from an archive/category page. However, all of our crowdfunding projects are open pricing, so the add to cart from archive pages feature for crowdfunding projects is not important for us. So, I modified the function accordingly to allow the button text to change.
function add_to_cart_text( $text, $_product ) { return $text; // return ( $this->is_open_price_product( $_product ) ) ? __( 'Read more', 'woocommerce' ) : $text; }
Also, I finally gave up getting WooCommerce shortcodes to print crowdfunding products correctly in an archive view. I just hard coded them into the page where I needed them, instead.
Would still appreciate a followup on that.
I have managed to track down the problem with the button text not working. I noticed the problem only happened on projects with open pricing enabled. So, I poked around through this file:
crowdfunding-for-woocommerce-pro\includes\class-wc-crowdfunding-open-pricing.php
… and noticed a typo in the word ‘crowdfunding’ on the function at line 46 as follows:
function is_open_price_product( $_product ) { $is_crowdfudning = ( 'yes' === get_post_meta( $_product->id, '_' . 'alg_crowdfunding_enabled', true ) ) ? true : false; $is_crowdfudning_open_price = ( 'yes' === get_post_meta( $_product->id, '_' . 'alg_crowdfunding_product_open_price_enabled', true ) ) ? true : false; return ( $is_crowdfudning && $is_crowdfudning_open_price ); }
Changed $is_crowdfudning to $is_crowdfunding, and the custom button text now gets applied correctly.
Still working on getting the projects to show correctly when called with a WooCommerce shortcode, but no progress on that yet.