Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add purchase link to access plan #2798

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelogs/fix_add-purchase-link-to-access-plan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: changed
links:
- "#2793"
entry: Adding purchase checkout link to the access plan header as an icon.
9 changes: 8 additions & 1 deletion includes/admin/views/access-plans/access-plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
$on_sale = $plan->get( 'on_sale' );
$availability = $plan->get( 'availability' );
$checkout_redirect_url = $plan->get( 'checkout_redirect_url' );
$checkout_url = $plan->get_checkout_url( false );
if ( false === strpos( $checkout_url, home_url() ) ) {
$checkout_url = home_url( $checkout_url );
}
}
?>

Expand All @@ -65,6 +69,9 @@
<span class="tip--top-left" data-tip="<?php esc_attr_e( 'Errors were found during access plan validation', 'lifterlms' ); ?>">
<span class="dashicons dashicons-warning"></span>
</span>
<?php if ( $plan ) : ?>
<a target="_blank" href="<?php echo esc_url( $checkout_url ); ?>"><span class="dashicons dashicons-admin-links llms-plan-purchase-link"></span></a>
<?php endif; ?>
<span class="dashicons dashicons-trash llms-plan-delete"></span>
<span class="dashicons dashicons-arrow-down"></span>
<span class="dashicons dashicons-arrow-up"></span>
Expand All @@ -88,7 +95,7 @@

<h4><?php esc_html_e( 'General Plan Information', 'lifterlms' ); ?></h4>
<?php if ( $plan ) : ?>
<p class="llms-plan-link"><?php printf( esc_html__( 'Direct to Checkout Purchase Link: %s', 'lifterlms' ), '<code>' . esc_url( $plan->get_checkout_url( false ) ) . '</code>' ); ?></p>
<p class="llms-plan-link"><?php printf( esc_html__( 'Direct to Checkout Purchase Link: %s', 'lifterlms' ), '<code>' . esc_url( $checkout_url ) . '</code>' ); ?></p>
<?php endif; ?>

<div class="llms-plan-row-1">
Expand Down
Loading