Hi
I know a little PHP but I am stuck trying to remove one of two buttons on a product hover overlay.
you can check the overlay on this page. (Frontend password: jazz4all
[https://www.jazz4all.org.au/vendor/helen-matthews/]
When you hover on the product download the 2 buttons show…one for “Purchase” and the other for “Details” I want to remove the Purchase button and leave the details button as a link to the product details. I tried to comment out the purchase button in CSS but that didn’t work.
Can you please help me with this?
Here is the PHP:
<?php
class Marketify_EDD_Template_Purchase_Form {
public function __construct() {
add_action( 'marketify_download_actions', array( $this, 'purchase_link' ) );
add_action( 'marketify_download_content_actions_before', array( $this, 'purchase_link' ) );
add_filter( 'edd_purchase_download_form', array( $this, 'download_form_class' ), 10, 2 );
add_filter( 'edd_button_colors', array( $this, 'button_colors' ) );
}
public function purchase_link( $download_id = null ) {
global $post, $edd_options;
if ( ! $download_id ) {
$download_id = $post->ID;
}
$variable = edd_has_variable_prices( $download_id );
$form = edd_get_purchase_link( array( 'download_id' => $download_id, 'price' => false ) );
// ghetto check for sold out
$label = edd_get_option( 'edd_purchase_limit_sold_out_label', 'Sold Out' );
$sold_out = strpos( $form, $label );
$in_cart = edd_item_in_cart( $download_id );
if ( ! $variable || $sold_out != false || ( $in_cart ) ) {
echo $form;
} else {
$button = ! empty( $edd_options[ 'add_to_cart_text' ] ) ? $edd_options[ 'add_to_cart_text' ] : __( 'Purchase', 'marketify' );
$class = 'button buy-now popup-trigger';
printf( '<a href="#buy-now-%s" class="%s">%s</a>', $post->ID, $class, $button );
// ouput the form here so things like wishlists can find something
echo $form;
}
}
public function download_form_class( $purchase_form, $args ) {
$download_id = $args[ 'download_id' ];
if ( ! $download_id || edd_has_variable_prices( $download_id ) ) {
return $purchase_form;
}
$purchase_form = str_replace( 'class="edd_download_purchase_form"', 'class="edd_download_purchase_form download-variable"', $purchase_form );
return $purchase_form;
}
public function button_colors( $colors ) {
$unset = array( 'white', 'blue', 'gray', 'red', 'green', 'yellow', 'orange', 'dark-gray' );
foreach ( $unset as $color ) {
unset( $colors[ $color ] );
}
return $colors;
}
}