本文整理汇总了PHP中edd_item_in_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_item_in_cart函数的具体用法?PHP edd_item_in_cart怎么用?PHP edd_item_in_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_item_in_cart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_ajax_add_to_cart
/**
* Adds item to the cart via AJAX.
*
* @since 1.0
* @return void
*/
function edd_ajax_add_to_cart()
{
if (isset($_POST['download_id']) && check_ajax_referer('edd_ajax_nonce', 'nonce')) {
global $post;
$to_add = array();
if (isset($_POST['price_ids']) && is_array($_POST['price_ids'])) {
foreach ($_POST['price_ids'] as $price) {
$to_add[] = array('price_id' => $price);
}
}
foreach ($to_add as $options) {
if (!edd_item_in_cart($_POST['download_id'], $options)) {
if ($_POST['download_id'] == $options['price_id']) {
$options = array();
}
$key = edd_add_to_cart($_POST['download_id'], $options);
$item = array('id' => $_POST['download_id'], 'options' => $options);
$item = apply_filters('edd_ajax_pre_cart_item_template', $item);
$cart_item = edd_get_cart_item_template($key, $item, true);
echo $cart_item;
} else {
echo 'incart';
}
}
}
edd_die();
}
示例2: edd_add_to_cart
/**
* Add To Cart
*
* Adds a download ID to the shopping cart.
* Uses edd_get_cart_contents().
*
* @access public
* @since 1.0
* @param $download_id - INT the ID number of the download to add to the cart
* @param $options - array an array of options, such as variable price
* @return string - cart key of the new item
*/
function edd_add_to_cart($download_id, $options = array())
{
$cart = edd_get_cart_contents();
if (!edd_item_in_cart($download_id)) {
if ('download' != get_post_type($download_id)) {
return;
}
// not a download product
do_action('edd_pre_add_to_cart', $download_id, $options);
if (edd_has_variable_prices($download_id) && !isset($options['price_id'])) {
// forces to the first price ID if none is specified and download has variable prices
$options['price_id'] = 0;
}
$cart_item = apply_filters('edd_add_to_cart_item', array('id' => $download_id, 'options' => $options));
if (is_array($cart)) {
$cart[] = $cart_item;
} else {
$cart = array($cart_item);
}
$_SESSION['edd_cart'] = $cart;
do_action('edd_post_add_to_cart', $download_id, $options);
// clear all the checkout errors, if any
edd_clear_errors();
return count($cart) - 1;
}
}
示例3: pw_edd_disable_gateway_on_checkout
function pw_edd_disable_gateway_on_checkout($gateways)
{
if (edd_is_checkout()) {
// Disable Stripe if the download with an ID of 10 is in the cart
if (edd_item_in_cart(10)) {
unset($gateways['stripe']);
}
}
return $gateways;
}
示例4: pw_edd_prevent_duplicate_cart_items
/**
* Prevents items from being added to the cart multiple times
*
*/
function pw_edd_prevent_duplicate_cart_items($download_id, $options)
{
if (edd_item_in_cart($download_id, $options)) {
if (edd_is_ajax_enabled()) {
die('1');
} else {
wp_redirect(edd_get_checkout_uri());
exit;
}
}
}
示例5: edd_ajax_add_to_cart
/**
* AJAX Add To Cart
*
* Adds item to the cart.
*
* @access private
* @since 1.0
* @return string
*/
function edd_ajax_add_to_cart()
{
if (isset($_POST['download_id']) && check_ajax_referer('edd_ajax_nonce', 'nonce')) {
global $post;
if (!edd_item_in_cart($_POST['download_id'])) {
$options = is_numeric($_POST['price_id']) ? array('price_id' => $_POST['price_id']) : array();
$key = edd_add_to_cart($_POST['download_id'], $options);
$item = array('id' => $_POST['download_id'], 'options' => $options);
$cart_item = edd_get_cart_item_template($key, $item, true);
echo $cart_item;
} else {
echo 'incart';
}
}
die;
}
示例6: edd_add_to_cart
/**
* Add To Cart
*
* Adds a download ID to the shopping cart.
* Uses edd_get_cart_contents().
*
* @access public
* @since 1.0
* @param $download_id - INT the ID number of the download to add to the cart
* @param $options - array an array of options, such as variable price
* @return string - cart key of the new item
*/
function edd_add_to_cart($download_id, $options = array())
{
$cart = edd_get_cart_contents();
if (!edd_item_in_cart($download_id)) {
do_action('edd_pre_add_to_cart', $download_id, $options);
if (is_array($cart)) {
$cart[] = array('id' => $download_id, 'options' => $options);
} else {
$cart = array(array('id' => $download_id, 'options' => $options));
}
$_SESSION['edd_cart'] = $cart;
do_action('edd_post_add_to_cart', $download_id, $options);
// clear all the checkout errors, if any
edd_clear_errors();
return count($cart) - 1;
}
}
示例7: edd_add_to_cart
/**
* Add To Cart
*
* Adds a download ID to the shopping cart.
*
* @since 1.0
*
* @param int $download_id Download IDs to be added to the cart
* @param array $options Array of options, such as variable price
*
* @return string Cart key of the new item
*/
function edd_add_to_cart($download_id, $options = array())
{
$cart = edd_get_cart_contents();
if (!edd_item_in_cart($download_id, $options)) {
$download = get_post($download_id);
if ('download' != $download->post_type) {
return;
}
// Not a download product
if (!current_user_can('edit_post', $download->ID) && ($download->post_status == 'draft' || $download->post_status == 'pending')) {
return;
}
// Do not allow draft/pending to be purchased if can't edit. Fixes #1056
do_action('edd_pre_add_to_cart', $download_id, $options);
if (edd_has_variable_prices($download_id) && !isset($options['price_id'])) {
// Forces to the first price ID if none is specified and download has variable prices
$options['price_id'] = 0;
}
$to_add = array();
if (isset($options['price_id']) && is_array($options['price_id'])) {
// Process multiple price options at once
foreach ($options['price_id'] as $price) {
$price_options = array('price_id' => $price);
$to_add[] = apply_filters('edd_add_to_cart_item', array('id' => $download_id, 'options' => $price_options));
}
} else {
// Add a single item
$to_add[] = apply_filters('edd_add_to_cart_item', array('id' => $download_id, 'options' => $options));
}
if (is_array($cart)) {
$cart = array_merge($cart, $to_add);
} else {
$cart = $to_add;
}
EDD()->session->set('edd_cart', $cart);
do_action('edd_post_add_to_cart', $download_id, $options);
// Clear all the checkout errors, if any
edd_clear_errors();
return count($cart) - 1;
}
}
示例8: edd_get_purchase_link
/**
* Get Purchase Link
*
* Builds a Purchase link for a specified download based on arguments passed.
* This function is used all over EDD to generate the Purchase or Add to Cart
* buttons. If no arguments are passed, the function uses the defaults that have
* been set by the plugin. The Purchase link is built for simple and variable
* pricing and filters are available throughout the function to override
* certain elements of the function.
*
* $download_id = null, $link_text = null, $style = null, $color = null, $class = null
*
* @since 1.0
* @param array $args Arguments for display
* @return string $purchase_form
*/
function edd_get_purchase_link($args = array())
{
global $edd_options, $post;
if (!isset($edd_options['purchase_page']) || $edd_options['purchase_page'] == 0) {
edd_set_error('set_checkout', sprintf(__('No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd'), admin_url('edit.php?post_type=download&page=edd-settings')));
edd_print_errors();
return false;
}
$post_id = is_object($post) ? $post->ID : 0;
$defaults = apply_filters('edd_purchase_link_defaults', array('download_id' => $post_id, 'price' => (bool) true, 'direct' => edd_get_download_button_behavior($post_id) == 'direct' ? true : false, 'text' => !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd'), 'style' => isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button', 'color' => isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue', 'class' => 'edd-submit'));
$args = wp_parse_args($args, $defaults);
if ('publish' != get_post_field('post_status', $args['download_id']) && !current_user_can('edit_product', $args['download_id'])) {
return false;
// Product not published or user doesn't have permission to view drafts
}
// Override color if color == inherit
$args['color'] = $args['color'] == 'inherit' ? '' : $args['color'];
$variable_pricing = edd_has_variable_prices($args['download_id']);
$data_variable = $variable_pricing ? ' data-variable-price="yes"' : 'data-variable-price="no"';
$type = edd_single_price_option_mode($args['download_id']) ? 'data-price-mode=multi' : 'data-price-mode=single';
if ($args['price'] && $args['price'] !== 'no' && !$variable_pricing) {
$price = edd_get_download_price($args['download_id']);
$button_text = !empty($args['text']) ? ' – ' . $args['text'] : '';
if (0 == $price) {
$args['text'] = __('Free', 'edd') . $button_text;
} else {
$args['text'] = edd_currency_filter(edd_format_amount($price)) . $button_text;
}
}
if (edd_item_in_cart($args['download_id']) && !$variable_pricing) {
$button_display = 'style="display:none;"';
$checkout_display = '';
} else {
$button_display = '';
$checkout_display = 'style="display:none;"';
}
global $edd_displayed_form_ids;
$form_id = !empty($args['form_id']) ? $args['form_id'] : 'edd_purchase_' . $args['download_id'];
$args = apply_filters('edd_purchase_link_args', $args);
ob_start();
?>
<form id="<?php
echo $form_id;
?>
" class="edd_download_purchase_form" method="post">
<?php
do_action('edd_purchase_link_top', $args['download_id'], $args);
?>
<div class="edd_purchase_submit_wrapper">
<?php
$class = implode(' ', array($args['style'], $args['color'], trim($args['class'])));
if (!edd_is_ajax_disabled()) {
echo '<a href="#" class="edd-add-to-cart ' . esc_attr($class) . '" data-action="edd_add_to_cart" data-download-id="' . esc_attr($args['download_id']) . '" ' . $data_variable . ' ' . $type . ' ' . $button_display . '><span class="edd-add-to-cart-label">' . $args['text'] . '</span> <span class="edd-loading"><i class="edd-icon-spinner edd-icon-spin"></i></span></a>';
}
echo '<input type="submit" class="edd-add-to-cart edd-no-js ' . esc_attr($class) . '" name="edd_purchase_download" value="' . esc_attr($args['text']) . '" data-action="edd_add_to_cart" data-download-id="' . esc_attr($args['download_id']) . '" ' . $data_variable . ' ' . $type . ' ' . $button_display . '/>';
echo '<a href="' . esc_url(edd_get_checkout_uri()) . '" class="edd_go_to_checkout ' . esc_attr($class) . '" ' . $checkout_display . '>' . __('Checkout', 'edd') . '</a>';
?>
<?php
if (!edd_is_ajax_disabled()) {
?>
<span class="edd-cart-ajax-alert">
<span class="edd-cart-added-alert" style="display: none;">
<?php
printf(__('<i class="edd-icon-ok"></i> Added to cart', 'edd'), '<a href="' . esc_url(edd_get_checkout_uri()) . '" title="' . __('Go to Checkout', 'edd') . '">', '</a>');
?>
</span>
</span>
<?php
}
?>
<?php
if (edd_display_tax_rate() && edd_prices_include_tax()) {
echo '<span class="edd_purchase_tax_rate">' . sprintf(__('Includes %1$s% tax', 'edd'), edd_get_tax_rate() * 100) . '</span>';
} elseif (edd_display_tax_rate() && !edd_prices_include_tax()) {
echo '<span class="edd_purchase_tax_rate">' . sprintf(__('Excluding %1$s% tax', 'edd'), edd_get_tax_rate() * 100) . '</span>';
}
?>
</div><!--end .edd_purchase_submit_wrapper-->
<input type="hidden" name="download_id" value="<?php
echo esc_attr($args['download_id']);
//.........这里部分代码省略.........
示例9: reach_edd_show_price
/**
* Display price before product purchase form.
*
* @param int $download_id
* @param array $args
* @param string $price
* @return void
* @since 1.0.0
*/
function reach_edd_show_price($download_id, $args, $price = null)
{
if (isset($args['price']) && 'no' === $args['price']) {
return;
}
if (edd_has_variable_prices($download_id) || edd_item_in_cart($download_id)) {
return;
}
if (is_null($price)) {
$price = reach_get_edd_product_price($download_id, $args);
}
if (false === $price) {
return;
}
?>
<div class="download-price"><?php
echo edd_currency_filter(edd_format_amount($price));
?>
</div>
<?php
}
示例10: edd_csau_add_to_cart_item
/**
* Store extra meta information against the download at the time it is added to the cart
*
* @param $info the default array of meta information stored with the download
* @return $info the new array of meta information
*
* @since 1.1
*/
function edd_csau_add_to_cart_item($info)
{
// Cross-sells
if (EDD()->session->get('edd_is_checkout')) {
// if item is added from checkout page, and it's trigger product is already in the cart, then mark as cross-sell
if (edd_item_in_cart(edd_csau_get_trigger_id($info['id'], 'cross_sell'))) {
$info['cross_sell'] = true;
}
} else {
// get the downloads trigger ID
$trigger_id = edd_csau_get_trigger_id($info['id'], 'upsell');
// if download does not have a trigger ID, exit
if (!$trigger_id) {
return $info;
}
// use the trigger ID to get an array of upsell IDs
$upsell_ids = get_post_meta($trigger_id, '_edd_csau_upsell_products');
// if this download exists in the upsell IDs array, then mark it as an upsell
if (EDD()->session->get('edd_is_single') && in_array($info['id'], $upsell_ids)) {
$info['upsell'] = true;
}
}
return $info;
}
示例11: add_ticket_to_cart
/**
* Handles the process of adding a ticket product to the cart.
*
* If the cart already contains a line item for the same product, simply increment the
* quantity for that item accordingly.
*
* @see bug #28917
* @param $product_id
* @param $quantity
*/
protected function add_ticket_to_cart($product_id, $quantity)
{
// Is the item in the cart already? Simply adjust the quantity if so
if (edd_item_in_cart($product_id)) {
$existing_quantity = edd_get_cart_item_quantity($product_id);
$quantity += $existing_quantity;
edd_set_cart_item_quantity($product_id, $quantity);
} else {
$options = array('quantity' => $quantity);
edd_add_to_cart($product_id, $options);
}
}
示例12: get_fees
/**
* Retrieve all active fees
*
* @access public
* @since 1.5
* @param string $type Fee type, "fee" or "item"
* @param int $download_id The download ID whose fees to retrieve
* @uses EDD_Session::get()
* @return mixed array|bool
*/
public function get_fees($type = 'fee', $download_id = 0)
{
$fees = EDD()->session->get('edd_cart_fees');
if (!edd_get_cart_contents()) {
// We can only get item type fees when the cart is empty
$type = 'item';
}
if (!empty($fees) && !empty($type) && 'all' !== $type) {
foreach ($fees as $key => $fee) {
if (!empty($fee['type']) && $type != $fee['type']) {
unset($fees[$key]);
}
}
}
if (!empty($fees) && !empty($download_id)) {
// Remove fees that don't belong to the specified Download
foreach ($fees as $key => $fee) {
if ((int) $download_id !== (int) $fee['download_id']) {
unset($fees[$key]);
}
}
}
if (!empty($fees)) {
// Remove fees that belong to a specific download but are not in the cart
foreach ($fees as $key => $fee) {
if (empty($fee['download_id'])) {
continue;
}
if (!edd_item_in_cart($fee['download_id'])) {
unset($fees[$key]);
}
}
}
return !empty($fees) ? $fees : array();
}
示例13: edd_wl_item_purchase
/**
* Wish list item purchase link
*
* @since 1.0
* @param [type] $item [description]
* @return [type] [description]
*/
function edd_wl_item_purchase($item, $args = array())
{
global $edd_options;
ob_start();
$defaults = apply_filters('edd_wl_add_to_cart_defaults', array('download_id' => $item['id'], 'text' => !empty($edd_options['edd_wl_add_to_cart']) ? $edd_options['edd_wl_add_to_cart'] : __('Add to cart', 'edd-wish-lists'), 'checkout_text' => __('Checkout', 'edd-wish-lists'), 'style' => edd_get_option('edd_wl_button_style', 'button'), 'color' => '', 'class' => 'edd-wl-action', 'wrapper' => 'span', 'wrapper_class' => '', 'link' => ''), $item['id']);
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
$style = 'edd-wl-button';
$variable_pricing = edd_has_variable_prices($download_id);
$data_variable = $variable_pricing ? ' data-variable-price=yes' : 'data-variable-price=no';
// price option
$data_price_option = $variable_pricing ? ' data-price-option=' . $item['options']['price_id'] : '';
$type = edd_single_price_option_mode($download_id) ? 'data-price-mode=multi' : 'data-price-mode=single';
if (edd_item_in_cart($download_id) && !$variable_pricing) {
// hide the 'add to cart' link
$button_display = 'style="display:none;"';
// show the 'checkout' link
$checkout_display = '';
} elseif ($variable_pricing && edd_item_in_cart($download_id, array('price_id' => $item['options']['price_id']))) {
// hide the 'add to cart' link
$button_display = 'style="display:none;"';
// show the 'checkout' link
$checkout_display = '';
} else {
// show the 'add to cart' link
$button_display = '';
// hide the 'checkout' link
$checkout_display = 'style="display:none;"';
}
$button_size = '';
// if link is specified, don't show spinner
$loading = !$link ? '<span class="edd-loading"><i class="edd-icon-spinner edd-icon-spin"></i></span>' : '';
$link = !$link ? '#' : $link;
$form_id = !empty($form_id) ? $form_id : 'edd_purchase_' . $download_id;
// add our default class
$default_wrapper_class = ' edd-wl-item-purchase';
$wrapper_class .= $wrapper_class ? $default_wrapper_class : trim($default_wrapper_class);
$default_css_class = apply_filters('edd_wl_item_purchase_default_css_classes', 'edd-add-to-cart-from-wish-list', $download_id);
?>
<form id="<?php
echo $form_id;
?>
" class="edd_download_purchase_form" method="post">
<div class="edd_purchase_submit_wrapper">
<?php
printf('<a href="%10$s" class="%11$s %1$s %8$s" data-action="edd_add_to_cart_from_wish_list" data-download-id="%3$s" %4$s %5$s %6$s %7$s><span class="label">%2$s</span>%9$s</a>', implode(' ', array($style, $color, trim($class))), esc_attr($text), esc_attr($download_id), esc_attr($data_variable), esc_attr($type), $button_display, esc_attr($data_price_option), $button_size, $loading, $link, $default_css_class);
// checkout link that shows when item is added to the cart
printf('<a href="%1$s" class="%2$s %3$s %5$s" %4$s>' . $checkout_text . '</a>', esc_url(edd_get_checkout_uri()), esc_attr('edd-go-to-checkout-from-wish-list'), implode(' ', array($style, $color, trim($class))), $checkout_display, $button_size);
?>
</div>
</form>
<?php
$html = '<' . $wrapper . ' class="' . $wrapper_class . '"' . '>' . ob_get_clean() . '</' . $wrapper . '>';
return apply_filters('edd_wl_item_purchase', $html, $item);
}
示例14: pp_get_purchase_link
/**
* Get Purchase Link
*
* Builds a Purchase link for a specified download based on arguments passed.
* This function is used all over EDD to generate the Purchase or Add to Cart
* buttons. If no arguments are passed, the function uses the defaults that have
* been set by the plugin. The Purchase link is built for simple and variable
* pricing and filters are available throughout the function to override
* certain elements of the function.
*
* $download_id = null, $link_text = null, $style = null, $color = null, $class = null
*
* @since 1.0
* @param array $args Arguments for display
* @return string $purchase_form
*/
function pp_get_purchase_link($args = array())
{
global $post, $edd_displayed_form_ids;
$purchase_page = edd_get_option('purchase_page', false);
if (!$purchase_page || $purchase_page == 0) {
edd_set_error('set_checkout', sprintf(__('No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd'), admin_url('edit.php?post_type=download&page=edd-settings')));
edd_print_errors();
return false;
}
$post_id = is_object($post) ? $post->ID : 0;
$defaults = apply_filters('edd_purchase_link_defaults', array('download_id' => $post_id, 'price' => (bool) true, 'price_id' => isset($args['price_id']) ? $args['price_id'] : false, 'direct' => edd_get_download_button_behavior($post_id) == 'direct' ? true : false, 'text' => edd_get_option('add_to_cart_text', __('Purchase', 'edd')), 'style' => edd_get_option('button_style', 'button'), 'color' => edd_get_option('checkout_color', 'blue'), 'class' => 'edd-submit'));
$args = wp_parse_args($args, $defaults);
// Override the stright_to_gateway if the shop doesn't support it
if (!edd_shop_supports_buy_now()) {
$args['direct'] = false;
}
$download = new EDD_Download($args['download_id']);
if (empty($download->ID)) {
return false;
}
if ('publish' !== $download->post_status && !current_user_can('edit_product', $download->ID)) {
return false;
// Product not published or user doesn't have permission to view drafts
}
// Override color if color == inherit
$args['color'] = $args['color'] == 'inherit' ? '' : $args['color'];
$options = array();
$variable_pricing = $download->has_variable_prices();
$data_variable = $variable_pricing ? ' data-variable-price="yes"' : 'data-variable-price="no"';
$type = $download->is_single_price_mode() ? 'data-price-mode=multi' : 'data-price-mode=single';
$show_price = $args['price'] && $args['price'] !== 'no';
$data_price_value = 0;
if ($variable_pricing && false !== $args['price_id']) {
$price_id = $args['price_id'];
$prices = $download->prices;
$options['price_id'] = $args['price_id'];
$found_price = isset($prices[$price_id]) ? $prices[$price_id]['amount'] : false;
$data_price_value = $found_price;
if ($show_price) {
$price = $found_price;
}
} elseif (!$variable_pricing) {
$data_price_value = $download->price;
if ($show_price) {
$price = $download->price;
}
}
$data_price = 'data-price="' . $data_price_value . '"';
$button_text = !empty($args['text']) ? ' – ' . $args['text'] : '';
if (isset($price) && false !== $price) {
if (0 == $price) {
$args['text'] = __('Free', 'edd') . $button_text;
} else {
$args['text'] = edd_currency_filter(edd_format_amount($price)) . $button_text;
}
}
if (edd_item_in_cart($download->ID, $options) && (!$variable_pricing || !$download->is_single_price_mode())) {
$button_display = 'style="display:none;"';
$checkout_display = '';
} else {
$button_display = '';
$checkout_display = 'style="display:none;"';
}
// Collect any form IDs we've displayed already so we can avoid duplicate IDs
if (isset($edd_displayed_form_ids[$download->ID])) {
$edd_displayed_form_ids[$download->ID]++;
} else {
$edd_displayed_form_ids[$download->ID] = 1;
}
$form_id = !empty($args['form_id']) ? $args['form_id'] : 'edd_purchase_' . $download->ID;
// If we've already generated a form ID for this download ID, apped -#
if ($edd_displayed_form_ids[$download->ID] > 1) {
$form_id .= '-' . $edd_displayed_form_ids[$download->ID];
}
$args = apply_filters('edd_purchase_link_args', $args);
ob_start();
?>
<form id="<?php
echo $form_id;
?>
" class="edd_download_purchase_form edd_purchase_<?php
echo absint($download->ID);
?>
//.........这里部分代码省略.........
示例15: edd_csau_html
//.........这里部分代码省略.........
<h2><?php
echo esc_attr($heading);
?>
</h2>
<?php
while ($downloads->have_posts()) {
$downloads->the_post();
?>
<div itemscope itemtype="http://schema.org/Product" class="<?php
echo apply_filters('edd_download_class', 'edd_download', '', '');
?>
" id="edd_download_<?php
echo get_the_ID();
?>
">
<div class="edd_download_inner">
<?php
do_action('edd_csau_download_before');
$show_excerpt = apply_filters('edd_csau_show_excerpt', true);
$show_price = apply_filters('edd_csau_show_price', true);
$show_button = apply_filters('edd_csau_upsell_show_button', true);
edd_get_template_part('shortcode', 'content-image');
edd_get_template_part('shortcode', 'content-title');
if ($show_price) {
edd_get_template_part('shortcode', 'content-price');
}
if ($show_excerpt) {
edd_get_template_part('shortcode', 'content-excerpt');
}
// if the download is not in the cart, show the add to cart button
if (edd_is_checkout()) {
if (!edd_item_in_cart(get_the_ID())) {
$text = apply_filters('edd_csau_cross_sell_add_to_cart_text', __('Add to cart', 'edd-csau'));
$price = apply_filters('edd_csau_cross_sell_show_button_price', false);
if ($show_button) {
?>
<div class="edd_download_buy_button">
<?php
echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'text' => $text, 'price' => $price));
?>
</div>
<?php
}
?>
<?php
} else {
echo apply_filters('edd_csau_added_to_cart_text', '<span class="edd-cart-added-alert"><i class="edd-icon-ok"></i> ' . __('Added to cart', 'edd-csau') . '</span>');
}
} else {
$text = apply_filters('edd_csau_upsell_add_to_cart_text', __('Add to cart', 'edd-csau'));
$price = apply_filters('edd_csau_upsell_show_button_price', false);
$show_button = apply_filters('edd_csau_upsell_show_button', true);
if ($show_button) {
?>
<div class="edd_download_buy_button">
<?php
echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'text' => $text, 'price' => $price));
?>
</div>
<?php
}